amoghrajesh commented on code in PR #49005:
URL: https://github.com/apache/airflow/pull/49005#discussion_r2035412898
##########
airflow-core/tests/unit/dag_processing/test_processor.py:
##########
@@ -181,6 +181,29 @@ def dag_in_a_fn():
if result.import_errors:
assert "VARIABLE_NOT_FOUND" in
next(iter(result.import_errors.values()))
+ def test_top_level_variable_set(self, tmp_path: pathlib.Path):
+ logger_filehandle = MagicMock()
+
+ def dag_in_a_fn():
+ from airflow.sdk import DAG, Variable
+
+ Variable.set(key="mykey", value="myvalue")
+ with DAG(f"test_{Variable.get('mykey')}"):
+ ...
+
+ path = write_dag_in_a_fn_to_file(dag_in_a_fn, tmp_path)
+ proc = DagFileProcessorProcess.start(
+ id=1, path=path, bundle_path=tmp_path, callbacks=[],
logger_filehandle=logger_filehandle
+ )
+
+ while not proc.is_ready:
+ proc._service_subprocess(0.1)
+
+ result = proc.parsing_result
+ assert result is not None
+ assert result.import_errors == {}
+ assert result.serialized_dags[0].dag_id == "test_myvalue"
Review Comment:
Handled it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]