Refactored polls module into layered architecture with typed domain objects, isolated SSE handling, and comprehensive tests.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 4s
CI / Tests (Python 3.12) (push) Successful in 2m54s
CI / Tests (Python 3.13) (push) Successful in 2m54s
CI / Tests (Python 3.14) (push) Successful in 2m52s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 5s
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 4s
CI / Tests (Python 3.12) (push) Successful in 2m54s
CI / Tests (Python 3.13) (push) Successful in 2m54s
CI / Tests (Python 3.14) (push) Successful in 2m52s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 5s
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -86,16 +86,6 @@ def manager(module_context: ModuleContext, repo: TimerRepository) -> TimerManage
|
||||
return TimerManager(module_context, repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fast_sleep(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Patch asyncio.sleep; use _REAL_ASYNCIO_SLEEP for real waits."""
|
||||
|
||||
async def _fake(duration: float) -> None:
|
||||
await _REAL_ASYNCIO_SLEEP(0)
|
||||
|
||||
monkeypatch.setattr(asyncio, "sleep", _fake)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def _suppress_timer_tasks(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Stub Timer.start so enabling a timer does not spawn a background task."""
|
||||
|
||||
@@ -20,6 +20,7 @@ loaded via ``pytest_plugins`` below.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
@@ -29,6 +30,8 @@ if TYPE_CHECKING:
|
||||
|
||||
pytest_plugins = ["owlbot.testing.plugin", "pytester"]
|
||||
|
||||
_REAL_ASYNCIO_SLEEP = asyncio.sleep
|
||||
|
||||
|
||||
def pytest_addoption(parser: pytest.Parser) -> None:
|
||||
"""Register ``--run-integration`` for the integration-test opt-in flag."""
|
||||
@@ -50,3 +53,17 @@ def pytest_collection_modifyitems(
|
||||
for item in items:
|
||||
if "integration" in item.keywords:
|
||||
item.add_marker(skip)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fast_sleep(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Patch ``asyncio.sleep`` so background lifecycle tasks run immediately."""
|
||||
|
||||
async def _fake_sleep(
|
||||
_duration: float,
|
||||
result: object | None = None,
|
||||
) -> object | None:
|
||||
await _REAL_ASYNCIO_SLEEP(0)
|
||||
return result
|
||||
|
||||
monkeypatch.setattr(asyncio, "sleep", _fake_sleep)
|
||||
|
||||
Reference in New Issue
Block a user