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

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new e2a2fd4ef2b Fix `tests_common` pytest plugin from running in system 
tests (#77389)
e2a2fd4ef2b is described below

commit e2a2fd4ef2b61e042290f923d4b65bfa78eafc72
Author: Parag Ekbote <[email protected]>
AuthorDate: Mon Nov 23 00:54:38 2026 +0530

    Fix `tests_common` pytest plugin from running in system tests (#77389)
---
 devel-common/src/tests_common/pytest_plugin.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/devel-common/src/tests_common/pytest_plugin.py 
b/devel-common/src/tests_common/pytest_plugin.py
index da328441d4c..3305b00045d 100644
--- a/devel-common/src/tests_common/pytest_plugin.py
+++ b/devel-common/src/tests_common/pytest_plugin.py
@@ -207,7 +207,14 @@ else:
 # End of copied code from breeze
 
 os.environ["AIRFLOW__CORE__ALLOWED_DESERIALIZATION_CLASSES"] = 
"airflow.*\nunit.*\n"
-os.environ["AIRFLOW__CORE__PLUGINS_FOLDER"] = 
os.fspath(AIRFLOW_CORE_TESTS_PATH / "unit" / "plugins")
+# Unit-test plugins register ClassBasedListener, which breaks on system-test 
task instances.
+# Check sys.argv before pytest parses options, and pass the result via env for 
xdist workers,
+# since config.option.system is not available this early.
+run_system_tests = "--system" in sys.argv or 
os.environ.get("_AIRFLOW_SYSTEM_TESTS") == "true"
+if run_system_tests:
+    os.environ["_AIRFLOW_SYSTEM_TESTS"] = "true"
+else:
+    os.environ["AIRFLOW__CORE__PLUGINS_FOLDER"] = 
os.fspath(AIRFLOW_CORE_TESTS_PATH / "unit" / "plugins")
 
 IS_MOCK_PLUGINS_MANAGER = bool(
     os.environ.get("_AIRFLOW_SKIP_DB_TESTS", "false") == "true" and 
importlib.util.find_spec("airflow")

Reply via email to