OverviewFilesCommitsIssuesDocsReleasesPeers

stremio-vsembed / test_suite_isolation.py

41 lines · python ref:
"""No test may write production state files (labs#13).

2026-10-04: the suite run on stortron at deploy appended seven fixture jobs
(`series:tmdb:1:1:1:720`, `tt16026746`, ...) to the REAL ingest_history.jsonl.
Older test files redirect INGEST_QUEUE_FILE but predate the history file, so
their jobs appended beside addon.py. Same shape as the 2026-08-31 queue
clobber: a path a test does not know about is a path it writes to production.

conftest redirects every such path for every test; this proves it.

Run:  .venv/bin/python3 -m pytest test_suite_isolation.py -q
"""

import os

import addon

HERE = os.path.dirname(os.path.abspath(addon.__file__))


def test_history_is_never_the_production_file():
    assert os.path.dirname(os.path.abspath(addon.INGEST_HISTORY_FILE)) != HERE


def test_jellyfin_config_is_never_the_production_file():
    assert os.path.dirname(os.path.abspath(addon.JELLYFIN_CONFIG)) != HERE


def test_subtitle_sync_state_is_never_production():
    assert os.path.dirname(os.path.abspath(addon.SUBTITLE_SYNC_FILE)) != HERE
    assert os.path.dirname(os.path.abspath(addon.SUBS_ORIGINAL_DIR)) != HERE
    assert addon._subsync_available() is False


def test_source_rejects_are_never_production():
    assert os.path.dirname(os.path.abspath(addon.SOURCE_REJECTS_FILE)) != HERE


def test_live_subtitles_are_never_production():
    assert os.path.dirname(os.path.abspath(addon.LIVE_SUBS_DIR)) != HERE