jason810496 commented on code in PR #46484:
URL: https://github.com/apache/airflow/pull/46484#discussion_r1966541837


##########
tests/api_fastapi/conftest.py:
##########
@@ -77,24 +68,36 @@ def make_dag_with_multiple_versions(dag_maker, session):
             ): '[{ "name": "dag_maker", "classpath": 
"airflow.dag_processing.bundles.git.GitDagBundle", "kwargs": {"subdir": "dags", 
"tracking_ref": "main", "refresh_interval": 0}}, { "name": 
"another_bundle_name", "classpath": 
"airflow.dag_processing.bundles.git.GitDagBundle", "kwargs": {"subdir": "dags", 
"tracking_ref": "main", "refresh_interval": 0}}]'
         }
     ):
-        dag_id = "dag_with_multiple_versions"
-
-        for version_number in range(1, 4):
-            with dag_maker(dag_id) as dag:
-                for task_number in range(version_number):
-                    EmptyOperator(task_id=f"task{task_number + 1}")
-            dag.sync_to_db()
-            SerializedDagModel.write_dag(
-                dag, bundle_name="dag_maker", 
bundle_version=f"some_commit_hash{version_number}"
-            )
-            dag_maker.create_dagrun(
-                run_id=f"run{version_number}",
-                logical_date=datetime.datetime(2020, 1, version_number, 
tzinfo=datetime.timezone.utc),
-                dag_version=DagVersion.get_version(dag_id=dag_id, 
version_number=version_number),
-            )
         yield
 
-        clear_db_connections(False)
+    clear_db_connections(False)

Review Comment:
   It's intended to be at that indentation level, ensuring that only `yield` is 
executed within the `with conf_vars` context.
   
   
https://github.com/jason810496/airflow/blob/feature/AIP-65/Add-dag-versions-to-DagRunResponse/tests/api_fastapi/conftest.py#L50-L74



-- 
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]

Reply via email to