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

This commit is contained in:
2026-05-11 11:58:47 -04:00
parent 4918547c7d
commit 06b4a0bb9c
19 changed files with 4172 additions and 1002 deletions
File diff suppressed because it is too large Load Diff
-10
View File
@@ -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."""
+17
View File
@@ -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)