Files
jetson 9a276b21f2 fix: isolate tests from real output/ dir via conftest autouse fixture
Tests imported the global job_queue (bound to real OUTPUT_DIR), creating
8 junk job-* dirs per pytest run (test_app x3, test_download_compress x4,
test_preview x1). Fixture redirects _output_dir to tmp_path and clears
the job registry before each test.
2026-09-28 13:55:47 +07:00

20 lines
541 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Global test isolation — keep tests out of the real output/ directory.
Tests import the global job_queue from app.py, which is bound to the real
OUTPUT_DIR. Without this, every pytest run leaves 8 junk job-* directories
in output/ (test_app × 3, test_download_compress × 4, test_preview × 1).
"""
import pytest
@pytest.fixture(autouse=True)
def _isolate_job_queue(tmp_path):
import app as app_module
q = app_module.job_queue
with q._lock:
q._output_dir = tmp_path / "output"
q._jobs.clear()
yield