fix: validate complete-day monitoring coverage
This commit is contained in:
+11
-2
@@ -60,6 +60,13 @@ def _clock(year=2026, month=9, day=30, hour=12):
|
||||
return datetime(year, month, day, hour, 0, 0, tzinfo=timezone.utc)
|
||||
|
||||
|
||||
class _FrozenTuiDateTime(datetime):
|
||||
@classmethod
|
||||
def now(cls, tz=None):
|
||||
instant = datetime(2026, 9, 28, 12, 0, 0, tzinfo=timezone.utc)
|
||||
return instant.replace(tzinfo=None) if tz is None else instant.astimezone(tz)
|
||||
|
||||
|
||||
def _insert_baseline(conn, tbw_tb=1.0, verified=True,
|
||||
model="Samsung SSD 970 EVO Plus 1TB"):
|
||||
conn.execute(
|
||||
@@ -1022,7 +1029,7 @@ class TestBarGraphTUI:
|
||||
assert len(graph._day_data) == 90
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_readout_updates_on_selection(self, tmp_path):
|
||||
async def test_readout_updates_on_selection(self, tmp_path, monkeypatch):
|
||||
"""Readout shows selected day info."""
|
||||
conn = init_store(tmp_path / "test.db")
|
||||
_insert_segment(conn)
|
||||
@@ -1034,6 +1041,7 @@ class TestBarGraphTUI:
|
||||
_insert_sample(conn, "2026-09-30T10:00:00+00:00")
|
||||
conn.close()
|
||||
|
||||
monkeypatch.setattr("fenris.tui.datetime", _FrozenTuiDateTime)
|
||||
app = FenrisTuiApp(store_path=tmp_path / "test.db")
|
||||
async with app.run_test(size=(80, 24)) as pilot:
|
||||
await pilot.press("v", "v")
|
||||
@@ -1056,7 +1064,7 @@ class TestBarGraphTUI:
|
||||
assert "W 0.105 GB known" in readout
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_hourly_drill_down_and_back(self, tmp_path):
|
||||
async def test_hourly_drill_down_and_back(self, tmp_path, monkeypatch):
|
||||
"""Enter drills into hourly view, Esc returns to daily."""
|
||||
conn = init_store(tmp_path / "test.db")
|
||||
_insert_segment(conn)
|
||||
@@ -1073,6 +1081,7 @@ class TestBarGraphTUI:
|
||||
_insert_sample(conn, "2026-09-30T10:00:00+00:00")
|
||||
conn.close()
|
||||
|
||||
monkeypatch.setattr("fenris.tui.datetime", _FrozenTuiDateTime)
|
||||
app = FenrisTuiApp(store_path=tmp_path / "test.db")
|
||||
async with app.run_test(size=(80, 24)) as pilot:
|
||||
await pilot.press("v", "v")
|
||||
|
||||
Reference in New Issue
Block a user