uranusjr commented on code in PR #51920:
URL: https://github.com/apache/airflow/pull/51920#discussion_r2168148970


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py:
##########
@@ -1602,3 +1602,45 @@ def test_should_respond_200_with_null_logical_date(self, 
test_client):
             "conf": {},
             "note": None,
         }
+
+
+class TestWatchDagRun:
+    # The way we init async engine does not work well with FastAPI app init.
+    # Creating the engine implicitly creates an event loop, which Airflow does
+    # once for the entire process; creating the FastAPI app also does, but our
+    # test setup does it once for each test. I don't know how to properly fix
+    # this without rewriting how Airflow does db; re-configuring the db for 
each
+    # test at least makes the tests run correctly.
+    @pytest.fixture(autouse=True)
+    def reconfigure_async_db_engine(self):
+        from airflow.settings import _configure_async_session
+
+        _configure_async_session()

Review Comment:
   The `test_should_respond_200_immediately_for_finished_run` tests fail for me 
without this (there are two fixtures; the first would pass but the second would 
fail)



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