fix: ruff findings
This commit is contained in:
+18
-19
@@ -5,7 +5,6 @@ Covers:
|
||||
- TPH-11: Single maker-credit placement, vendor wear under Drive health
|
||||
- Preserve: continuity, pause block, quit rail, auth banner
|
||||
"""
|
||||
import sqlite3
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
@@ -93,8 +92,8 @@ class TestFenrisIdentity:
|
||||
store_path=tmp_path / "nonexistent.db",
|
||||
refresh_interval_s=0.2,
|
||||
)
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
headline = str(app.query_one("#headline-band").render())
|
||||
async with app.run_test(size=(120, 24)):
|
||||
str(app.query_one("#headline-band").render())
|
||||
assert "🐺 Fenris by Bongbetic" in str(app.query_one("#identity").render())
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -105,8 +104,8 @@ class TestFenrisIdentity:
|
||||
refresh_interval_s=0.2,
|
||||
)
|
||||
# Simulate narrow terminal that can't render wolf
|
||||
async with app.run_test(size=(60, 24)) as pilot:
|
||||
headline = str(app.query_one("#headline-band").render())
|
||||
async with app.run_test(size=(60, 24)):
|
||||
str(app.query_one("#headline-band").render())
|
||||
# Either shows wolf or fallback - both are acceptable
|
||||
assert "Fenris by Bongbetic" in str(app.query_one("#identity").render())
|
||||
|
||||
@@ -117,7 +116,7 @@ class TestFenrisIdentity:
|
||||
store_path=tmp_path / "nonexistent.db",
|
||||
refresh_interval_s=0.2,
|
||||
)
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
headline = str(app.query_one("#headline-band").render())
|
||||
# No replacement character (U+FFFD) should appear
|
||||
assert "\ufffd" not in headline.lower()
|
||||
@@ -137,7 +136,7 @@ class TestFenrisIdentity:
|
||||
conn.close()
|
||||
|
||||
app = FenrisTuiApp(store_path=tmp_path / "test.db")
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
headline = str(app.query_one("#headline-band").render())
|
||||
# Identity appears once, lifespan is separate data
|
||||
assert "🐺 Fenris by Bongbetic" in str(app.query_one("#identity").render())
|
||||
@@ -160,7 +159,7 @@ class TestSingleMakerCredit:
|
||||
conn.close()
|
||||
|
||||
app = FenrisTuiApp(store_path=tmp_path / "test.db")
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
strip = str(app.query_one("#service-strip").render())
|
||||
# "by Bongbetic" should NOT appear in service strip
|
||||
assert "by Bongbetic" not in strip
|
||||
@@ -172,15 +171,15 @@ class TestSingleMakerCredit:
|
||||
store_path=tmp_path / "nonexistent.db",
|
||||
refresh_interval_s=0.2,
|
||||
)
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
headline = str(app.query_one("#headline-band").render())
|
||||
async with app.run_test(size=(120, 24)):
|
||||
str(app.query_one("#headline-band").render())
|
||||
assert "Fenris by Bongbetic" in str(app.query_one("#identity").render())
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_empty_store_no_maker_credit_in_strip(self, tmp_path):
|
||||
"""Empty store: no maker credit in service strip."""
|
||||
app = FenrisTuiApp(store_path=tmp_path / "nonexistent.db")
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
strip = str(app.query_one("#service-strip").render())
|
||||
assert "by Bongbetic" not in strip
|
||||
|
||||
@@ -191,7 +190,7 @@ class TestSingleMakerCredit:
|
||||
db = tmp_path / "test.db"
|
||||
db.write_bytes(b"not a database")
|
||||
app = FenrisTuiApp(store_path=db)
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
strip = str(app.query_one("#service-strip").render())
|
||||
assert "by Bongbetic" not in strip
|
||||
|
||||
@@ -212,7 +211,7 @@ class TestDriveHealthVendorWear:
|
||||
conn.close()
|
||||
|
||||
app = FenrisTuiApp(store_path=tmp_path / "test.db")
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
health = str(app.query_one("#drive-health").render())
|
||||
# Vendor wear should be present with health context
|
||||
assert "vendor wear" in health.lower()
|
||||
@@ -243,7 +242,7 @@ class TestDriveHealthVendorWear:
|
||||
conn.close()
|
||||
|
||||
app = FenrisTuiApp(store_path=tmp_path / "test.db")
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
health = str(app.query_one("#drive-health").render())
|
||||
# Should show 0% used or honest zero, not crash
|
||||
assert "vendor wear" in health.lower()
|
||||
@@ -265,7 +264,7 @@ class TestPreservedBehavior:
|
||||
"last_collect_ok": True, "last_collect_age_s": 60,
|
||||
"last_collect_reason": None,
|
||||
}):
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
strip = str(app.query_one("#service-strip").render())
|
||||
assert "continuity" in strip.lower()
|
||||
assert "monitoring" in strip.lower()
|
||||
@@ -274,7 +273,7 @@ class TestPreservedBehavior:
|
||||
async def test_quit_rail_preserved(self, tmp_path):
|
||||
"""Separate q Quit TUI rail preserved."""
|
||||
app = FenrisTuiApp(store_path=tmp_path / "nonexistent.db")
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
rail = str(app.query_one("#action-rail").render())
|
||||
assert "q Quit TUI" in rail
|
||||
|
||||
@@ -286,11 +285,11 @@ class TestPreservedBehavior:
|
||||
refresh_interval_s=0.2,
|
||||
)
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
headline = str(app.query_one("#headline-band").render())
|
||||
str(app.query_one("#headline-band").render())
|
||||
assert "polkit" in str(app.query_one("#auth-notice").render()).lower()
|
||||
# Should clear after first tick
|
||||
await pilot.pause(0.25)
|
||||
headline_after = str(app.query_one("#headline-band").render())
|
||||
str(app.query_one("#headline-band").render())
|
||||
assert not app.query_one("#auth-notice").display
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -312,7 +311,7 @@ class TestPreservedBehavior:
|
||||
"last_collect_ok": None, "last_collect_age_s": None,
|
||||
"last_collect_reason": None,
|
||||
}):
|
||||
async with app.run_test(size=(120, 24)) as pilot:
|
||||
async with app.run_test(size=(120, 24)):
|
||||
banner = str(app.query_one("#paused-banner").render())
|
||||
assert "paused" in banner.lower()
|
||||
assert "deliberate" in banner.lower()
|
||||
|
||||
Reference in New Issue
Block a user