mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 12:28:22 +00:00
test: reset upstream cooldowns between all tests
This commit is contained in:
@@ -31,3 +31,13 @@ def _isolate_redemption_negative_cache() -> Iterator[None]:
|
|||||||
redemption_negative_cache.clear()
|
redemption_negative_cache.clear()
|
||||||
yield
|
yield
|
||||||
redemption_negative_cache.clear()
|
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()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import pytest
|
|||||||
|
|
||||||
from routstr.core.exceptions import UpstreamError
|
from routstr.core.exceptions import UpstreamError
|
||||||
from routstr.core.settings import settings
|
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
|
from routstr.upstream.stream_timeout import open_guarded_stream
|
||||||
|
|
||||||
|
|
||||||
@@ -33,13 +33,6 @@ async def _stalls_after_first() -> AsyncIterator[bytes]:
|
|||||||
yield b"never delivered"
|
yield b"never delivered"
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def _clean_cooldowns() -> Any:
|
|
||||||
reset_cooldowns()
|
|
||||||
yield
|
|
||||||
reset_cooldowns()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fast_timeouts(monkeypatch: pytest.MonkeyPatch) -> None:
|
def fast_timeouts(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
monkeypatch.setattr(settings, "upstream_first_token_timeout_seconds", 0.01)
|
monkeypatch.setattr(settings, "upstream_first_token_timeout_seconds", 0.01)
|
||||||
|
|||||||
Reference in New Issue
Block a user