This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new 5497e02faab [v3-1-test] Cleanup tmp_file.py in DagBag test. (#60272) 
(#60306)
5497e02faab is described below

commit 5497e02faab8de7cef1db3e74899082c2f8ba5b0
Author: Josef Šimánek <[email protected]>
AuthorDate: Fri Jan 9 20:15:29 2026 +0100

    [v3-1-test] Cleanup tmp_file.py in DagBag test. (#60272) (#60306)
    
    (cherry picked from commit 0951ed1889b2e5811b0ae6eaa32ce1a6f5718112)
---
 airflow-core/tests/unit/models/test_dagbag.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/airflow-core/tests/unit/models/test_dagbag.py 
b/airflow-core/tests/unit/models/test_dagbag.py
index 943d9f094b5..5c064c973ac 100644
--- a/airflow-core/tests/unit/models/test_dagbag.py
+++ b/airflow-core/tests/unit/models/test_dagbag.py
@@ -602,15 +602,15 @@ with airflow.DAG(
             python_callable=f,
         )
         """
-        with open("tmp_file.py", "w") as f:
-            f.write(code_to_save)
+        test_file = tmp_path / "tmp_file.py"
+        test_file.write_text(code_to_save)
 
         with conf_vars({("core", "DAGBAG_IMPORT_TIMEOUT"): "0.01"}):
-            dagbag = DagBag(dag_folder=os.fspath("tmp_file.py"), 
include_examples=False)
-            dag = dagbag._load_modules_from_file("tmp_file.py", 
safe_mode=False)
+            dagbag = DagBag(dag_folder=str(test_file), include_examples=False)
+            dag = dagbag._load_modules_from_file(str(test_file), 
safe_mode=False)
 
         assert dag is not None
-        assert "tmp_file.py" in dagbag.import_errors
+        assert str(test_file) in dagbag.import_errors
         assert "DagBag import timeout for" in caplog.text
 
     @staticmethod

Reply via email to