diff options
Diffstat (limited to 'lib/project/tests/conftest.py')
| -rw-r--r-- | lib/project/tests/conftest.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/project/tests/conftest.py b/lib/project/tests/conftest.py index 0155384..9cde05f 100644 --- a/lib/project/tests/conftest.py +++ b/lib/project/tests/conftest.py @@ -12,6 +12,31 @@ from producer.config import resolve from producer.setup import ensure_ffmpeg +@pytest.fixture(autouse=True) +def producer_root(tmp_path, monkeypatch): + """Isolated shared logs directory for every test: report logs always go + under <PRODUCER_ROOT>/logs.""" + root = tmp_path / "producer-root" + monkeypatch.setenv("PRODUCER_ROOT", str(root)) + return root + + +@pytest.fixture +def logs(producer_root): + return producer_root / "logs" + + +@pytest.fixture +def report_of(logs): + """Locate the one published report for an audio destination; report names + are timestamped, so tests glob by stem.""" + def find(target): + matches = sorted(logs.glob(f"{target.stem}.*.report.json")) + assert len(matches) == 1, matches + return matches[0] + return find + + @pytest.fixture def progress(): return lambda *_: None |
