From 5c2e5cb972212235b6ab24d161ca877927215e65 Mon Sep 17 00:00:00 2001 From: pasitnusso Date: Sun, 18 Oct 2026 01:58:40 +0700 Subject: [PATCH] Parametrize theme test across screens to parallelize in CI Closes #16 --- tests/test_app.py | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index 485e709..10adac2 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -769,10 +769,8 @@ async def scenario() -> None: run(scenario()) -def test_every_theme_paints_every_screen(book: Book, tmp_path, monkeypatch) -> None: - """The stylesheet is all theme variables; a missing one fails at load. - - Also: the choice is saved, and the transparent theme turns on the ANSI +def test_theme_choice_persists_and_transparency(book: Book, tmp_path, monkeypatch) -> None: + """The choice is saved, and the transparent theme turns on the ANSI colour that keeps the terminal's background showing through. """ monkeypatch.setenv("XDG_STATE_HOME", str(tmp_path)) @@ -785,18 +783,35 @@ async def scenario() -> None: await pilot.pause() assert app.theme == themes.DEFAULT_THEME assert app.ansi_color is True - for key in ("i", "w", "n", "e", "m", "P"): - await pilot.press(key) - await pilot.pause(0.2) - for name in app.available_themes: - app.theme = name - await pilot.pause() - await pilot.press("escape") - await pilot.press("escape") - await pilot.pause(0.2) app.theme = "dracula-neutral" await pilot.pause() assert app.ansi_color is None run(scenario()) assert themes.load_theme() == "dracula-neutral" + + +@pytest.mark.parametrize( + "key", + ["", "i", "w", "n", "e", "m", "P"], + ids=["recipes", "inventory", "storage", "nanites", "effects", "multitools", "portals"], +) +def test_every_theme_paints_every_screen( + book: Book, tmp_path, monkeypatch, key: str +) -> None: + """The stylesheet is all theme variables; a missing one fails at load.""" + monkeypatch.setenv("XDG_STATE_HOME", str(tmp_path)) + + async def scenario() -> None: + app = RecipeApp(book) + app.inv = Inventory(tmp_path / "inv.json") + async with app.run_test(size=(140, 40)) as pilot: + await pilot.pause() + if key: + await pilot.press(key) + await pilot.pause(0.2) + for name in app.available_themes: + app.theme = name + await pilot.pause() + + run(scenario())