You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2026/01/16 08:59:56 UTC

(airflow) 14/43: [v3-1-test] Cleanup tmp_file.py in DagBag test. (#60272) (#60306)

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

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

commit e47bc6afd8c79a9a85ee5ca917e436fc0fbdca4c
Author: Josef Šimánek <jo...@gmail.com>
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