import sys from pathlib import Path import pytest ANALYSIS = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ANALYSIS)) from pe_analysis import gitlab # noqa: E402 @pytest.fixture(scope="session") def mirror(): if not gitlab.MIRROR.exists(): pytest.skip("no local mirror; run pe_analysis.gitlab.pull() first") return gitlab.MIRROR @pytest.fixture(scope="session") def sessions(mirror): paths = gitlab.session_files(mirror) if not paths: pytest.skip("mirror is empty") return paths @pytest.fixture(scope="session") def pilot03(mirror): p = mirror / "pilot" / "PILOT03" / "PILOT03_2026-08-09_01h06.29.msgpack" if not p.exists(): pytest.skip(f"{p.name} not in the mirror") return p @pytest.fixture(scope="session") def watch_session(mirror): """A session that ran the night watch, the block added after the raids. Any of them: the fixture picks the newest, so it keeps working as the pool grows and does not pin the tests to one participant. """ paths = [p for p in gitlab.session_files(mirror) if _ran_the_watch(p)] if not paths: pytest.skip("no night-watch session in the mirror") return sorted(paths)[-1] def _ran_the_watch(path): from pe_analysis import loader names = {r.get("name") for r in loader.read_records(path)} return "NightWatch" in names