"""Outer conftest for the blackbox pytest tree. This file re-uses the runner-image conftest by re-exporting its hooks and fixtures. Inside the docker container the runner-image conftest is on the PYTHONPATH (via `/opt/e2e-runner/runner/conftest.py`); pytest discovers that conftest as the "rootdir" conftest because `pytest.ini` lives at `/opt/e2e-runner/`. The shim here exists so a developer can also point pytest at this directory directly (e.g., `pytest e2e/tests/positive/test_smoke.py`) when iterating outside docker — the shim adds the runner package to sys.path and re-imports everything. """ from __future__ import annotations import sys from pathlib import Path def _bootstrap_runner_path() -> None: """Make `runner.*` imports work when running outside the docker image.""" here = Path(__file__).resolve() # When inside the docker image, runner/ lives at /opt/e2e-runner/runner. # When iterating locally, runner/ lives at /e2e/runner. candidates = [ Path("/opt/e2e-runner"), here.parents[1], # e2e/ ] for c in candidates: if (c / "runner").is_dir(): if str(c) not in sys.path: sys.path.insert(0, str(c)) return _bootstrap_runner_path() # Re-export the runner conftest's hooks/fixtures so pytest picks them up # regardless of which conftest it discovers first. Star imports here are # the documented pytest pattern for conftest layering. from runner.conftest import * # noqa: F401,F403,E402 — pytest conftest re-export import pytest # noqa: E402 from runner.helpers import sitl_observer # noqa: E402 @pytest.fixture(scope="session") def sitl_replay_ready() -> bool: """True iff the FDR-replay fixture directory is configured + present. AZ-595 replaces the per-scenario `_harness_helpers_implemented` probes that passed `/tmp/non-existent` to each helper and inspected the exception type. Scenarios should now consult this fixture and skip cleanly when the SITL replay fixtures haven't been prepared (the typical case during local unit runs that only exercise the helpers). """ return sitl_observer.replay_dir_available()