OverviewFilesCommitsIssuesDocsReleasesPeers

stremio-vsembed commits / 338336d

Tests never write the production history file
The deploy-time suite run on stortron appended seven fixture jobs to the real ingest_history.jsonl: older test files redirect the queue but predate the history file. conftest now gives every test its own; test_suite_isolation proves history and jellyfin config never resolve beside addon.py. Red first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
338336ddbb66816aa62e2ec331cee778d2e05399
by plankatron <fleeky@gmail.com> · 2026-10-05T00:58:01.000Z

Changed files (2) +37 -0

conftest.py +11 -0
……@@ -14,6 +14,17 @@ import pytest
1414import addon
1515
1616
17@pytest.fixture(autouse=True)
18def no_production_history(tmp_path, monkeypatch):
19 """2026-10-04: the deploy-time suite run appended seven fixture jobs to the
20 REAL ingest_history.jsonl -- older test files redirect the queue but
21 predate the history file. Every test gets its own; a test that wants to
22 read one sets it explicitly (and lands in its own tmp_path anyway)."""
23 monkeypatch.setattr(addon, "INGEST_HISTORY_FILE",
24 str(tmp_path / "ingest_history.jsonl"))
25 yield
26
27
1728@pytest.fixture(autouse=True)
1829def no_hdhub_network(monkeypatch):
1930 def refuse(*a, **k):
test_suite_isolation.py +26 -0
……@@ -0,0 +1,26 @@
1"""No test may write production state files (labs#13).
2
32026-10-04: the suite run on stortron at deploy appended seven fixture jobs
4(`series:tmdb:1:1:1:720`, `tt16026746`, ...) to the REAL ingest_history.jsonl.
5Older test files redirect INGEST_QUEUE_FILE but predate the history file, so
6their jobs appended beside addon.py. Same shape as the 2026-08-31 queue
7clobber: a path a test does not know about is a path it writes to production.
8
9conftest redirects every such path for every test; this proves it.
10
11Run: .venv/bin/python3 -m pytest test_suite_isolation.py -q
12"""
13
14import os
15
16import addon
17
18HERE = os.path.dirname(os.path.abspath(addon.__file__))
19
20
21def test_history_is_never_the_production_file():
22 assert os.path.dirname(os.path.abspath(addon.INGEST_HISTORY_FILE)) != HERE
23
24
25def test_jellyfin_config_is_never_the_production_file():
26 assert os.path.dirname(os.path.abspath(addon.JELLYFIN_CONFIG)) != HERE