Main made the strict ruff config the default (`ruff check .`, blocking), and
the branch's code carried 278 findings under it (main itself is clean). Fixed:
- PLW1510 (86): `check=False` on each subprocess.run, preserving behaviour,
as main's own sweep (0006a5e229) did.
- ASYNC220 (9, test fixtures only): `noqa` with the reason, main's convention
for a Popen that returns at once and whose handle the test drives.
- ruff's safe autofixes plus the narrow unsafe ones (UP006/UP037/RUF100/RUF013/
PLR0402/RUF059 underscore renames/UP031/UP041/UP017/FURB167/PIE807/RUF007/
RUF015/RUF022/FURB162), and by hand: four %-formats to f-strings, three
unused unpacked names, one fixture loop over `.items()`.
No behaviour change. `ruff check .` passes; scripts/check passes; the 412 test
files mirroring every edited file pass (3 tests/pm files that fail only under
that batch's uv lookup pass solo, before and after this commit).
17 lines
799 B
Python
17 lines
799 B
Python
"""Recovered UTC routes coexist with legacy local-time routes."""
|
|
from datetime import datetime, timedelta, timezone, UTC
|
|
|
|
from gateway.config import GatewayConfig, Platform
|
|
from gateway.session import SessionSource, SessionStore
|
|
|
|
|
|
def test_list_sessions_orders_and_filters_mixed_clock_routes(tmp_path):
|
|
store = SessionStore(sessions_dir=tmp_path / 'sessions', config=GatewayConfig())
|
|
recent = store.get_or_create_session(SessionSource(platform=Platform.TELEGRAM, chat_id='recent'))
|
|
old = store.get_or_create_session(SessionSource(platform=Platform.TELEGRAM, chat_id='old'))
|
|
recent.updated_at = datetime.now(UTC)
|
|
old.updated_at = datetime.now() - timedelta(hours=2)
|
|
|
|
assert store.list_sessions() == [recent, old]
|
|
assert store.list_sessions(active_minutes=60) == [recent]
|