diff --git a/tests/conftest.py b/tests/conftest.py index d1bfa919..0e0ccbb3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,3 +31,13 @@ def _isolate_redemption_negative_cache() -> Iterator[None]: redemption_negative_cache.clear() yield redemption_negative_cache.clear() + + +@pytest.fixture(autouse=True) +def _isolate_upstream_cooldowns() -> Iterator[None]: + """Clear process-wide upstream cooldowns so one test's failures can't skip providers in the next.""" + from routstr.upstream.cooldown import reset_cooldowns + + reset_cooldowns() + yield + reset_cooldowns() diff --git a/tests/unit/test_upstream_stream_timeout.py b/tests/unit/test_upstream_stream_timeout.py index 2dd25310..0c5a57cf 100644 --- a/tests/unit/test_upstream_stream_timeout.py +++ b/tests/unit/test_upstream_stream_timeout.py @@ -11,7 +11,7 @@ import pytest from routstr.core.exceptions import UpstreamError from routstr.core.settings import settings -from routstr.upstream.cooldown import is_cooling_down, record_failure, reset_cooldowns +from routstr.upstream.cooldown import is_cooling_down, record_failure from routstr.upstream.stream_timeout import open_guarded_stream @@ -33,13 +33,6 @@ async def _stalls_after_first() -> AsyncIterator[bytes]: yield b"never delivered" -@pytest.fixture(autouse=True) -def _clean_cooldowns() -> Any: - reset_cooldowns() - yield - reset_cooldowns() - - @pytest.fixture def fast_timeouts(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(settings, "upstream_first_token_timeout_seconds", 0.01)