Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pytest from working outside breeze #43082

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests_common/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

_airflow_sources = os.getenv("AIRFLOW_SOURCES", None)
AIRFLOW_SOURCES_ROOT_DIR = (
Path(_airflow_sources) if _airflow_sources else Path(__file__).parents[2]
Path(_airflow_sources) if _airflow_sources else Path(__file__).parents[1]
).resolve()
AIRFLOW_TESTS_DIR = AIRFLOW_SOURCES_ROOT_DIR / "tests"

Expand Down Expand Up @@ -376,6 +376,8 @@ def pytest_configure(config: pytest.Config) -> None:
if path == desired:
break
else:
# This "desired" path should be the Airflow source directory (repo root)
assert (AIRFLOW_SOURCES_ROOT_DIR / ".asf.yaml").exists(), f"Path {desired} is not Airflow root"
sys.path.append(desired)

if (backend := config.getoption("backend", default=None)) and backend not in SUPPORTED_DB_BACKENDS:
Expand Down
Loading