| 1 | from helpers import files, migration |
| 2 | |
| 3 | |
| 4 | def test_cleanup_obsolete_removes_legacy_logs(tmp_path, monkeypatch): |
| 5 | logs = tmp_path / "logs" |
| 6 | logs.mkdir() |
| 7 | (logs / "old.html").write_text("old log", encoding="utf-8") |
| 8 | keep = tmp_path / "keep.txt" |
| 9 | keep.write_text("keep", encoding="utf-8") |
| 10 | monkeypatch.setattr(files, "_base_dir", str(tmp_path)) |
| 11 | |
| 12 | migration._cleanup_obsolete() |
| 13 | migration._cleanup_obsolete() |
| 14 | |
| 15 | assert not logs.exists() |
| 16 | assert keep.exists() |