shahar1 commented on code in PR #77389:
URL: https://github.com/apache/airflow/pull/77389#discussion_r4644135558
##########
devel-common/src/tests_common/pytest_plugin.py:
##########
@@ -207,7 +207,8 @@ def _calculate_provider_deps_hash():
# 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")
+if "--system" not in sys.argv:
Review Comment:
pytest-xdist workers will not see this check. As the comment at lines
123–128 of this file says, "python-xdist spawns separate processes and does not
pass all args to them (it's done via env variables)". So with `pytest --system
-n N`, each worker imports this module without `--system` in `sys.argv` and
still points the plugins folder at `unit/plugins`. The same happens when
`--system` comes from `PYTEST_ADDOPTS`.
Could you follow the `_AIRFLOW_SKIP_DB_TESTS` pattern? For example:
```python
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")
```
Optional (nit): `devel-common/tests/unit/tests_common/test_pytest_plugin.py`
already exists, so a small test that re-imports the module with `sys.argv`
patched would cover this branch.
--
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]