"""Fixtures for the pointer tests. Nothing here sleeps and nothing connects. ``src`` goes on the path because these tests run straight out of a checkout (``nix develop -c python -m pytest tests/pointer -q``) rather than against an installed package. """ from __future__ import annotations import sys from pathlib import Path import pytest sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "src")) from hhstreamd.pointer import PointerLease # noqa: E402 class FakeClock: """The injected clock. Tests move time; time never moves on its own.""" def __init__(self, now: float = 1000.0) -> None: self.now = float(now) def __call__(self) -> float: return self.now def advance(self, seconds: float) -> None: self.now += float(seconds) @pytest.fixture def clock() -> FakeClock: return FakeClock() @pytest.fixture def lease(clock: FakeClock) -> PointerLease: """Short deadlines so the arithmetic in a failing test is readable.""" return PointerLease(ttl_s=30.0, max_s=300.0, clock=clock)