testsAndMisc/python_pkg/wallpaper_rotator/tests/test_main.py
Krzysztof kuhy Rudnicki d502580e3f Dark wallpaper rotator: new style every 3 h
Six text-free styles (gradient, flow/Voronoi, habit heatmap, shutdown
clock, Earth day/night, plasma) replace the white i3 root. A 15-minute
systemd user timer picks a new random style per monitor every 3 hours,
unlike its previous one and the other monitor's; live styles refresh in
between. Also syncs i3/config with the live config and prunes the
oldest evidence artifact for the 60-file cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWX51FMD58yKUC1eYWf
2026-11-11 16:31:06 +01:00

34 lines
915 B
Python

"""Tests for the ``python3 -m python_pkg.wallpaper_rotator`` entry point."""
from __future__ import annotations
import logging
import runpy
import pytest
from python_pkg.wallpaper_rotator import _tick
def _run_main(
monkeypatch: pytest.MonkeyPatch,
caplog: pytest.LogCaptureFixture,
outcome: object,
) -> list[str]:
monkeypatch.setattr(_tick, "tick", lambda: outcome)
with caplog.at_level(logging.INFO):
runpy.run_module("python_pkg.wallpaper_rotator", run_name="__main__")
return caplog.messages
def test_main_reports_a_repaint(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
assert "painted" in _run_main(monkeypatch, caplog, outcome=1)
def test_main_reports_an_unchanged_background(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
assert "unchanged" in _run_main(monkeypatch, caplog, outcome=0)