ashb commented on code in PR #43738: URL: https://github.com/apache/airflow/pull/43738#discussion_r1830983646
########## tests_common/pytest_plugin.py: ########## @@ -31,6 +31,18 @@ import pytest import time_machine +# NOTE: DO NOT IMPORT AIRFLOW THINGS HERE! +# +# This plugin is responsible for configuring Airflow correctly to run tests. +# Importing Airflow here loads Airflow too eagerly and break the configurations. +# Instead, import what you want lazily inside a fixture function. +# +# Be aware that many things in tests_common also indirectly imports Airflow, so +# those modules also should not be imported globally. +# +# (Things in the TYPE_CHECKING block are fine because they are not actually +# imported at runtime; those imports are only hints to the type checker.) Review Comment: Is it worth addming a check? Something like this? ```suggestion # imported at runtime; those imports are only hints to the type checker.) assert "airflow" not in sys.modules ``` -- 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]
