Raised by @emlynjdavies on #394. pyopia/tests/conftest.py (added in #394) uses @pytest.fixture(scope='session') to share expensive real setup (network download of the example model/image, a real end-to-end process run) across multiple tests instead of repeating it per test.
This differs from the existing pattern in test_pipeline.py and test_classify.py, where each test function independently opens its own tempfile.TemporaryDirectory() and downloads its own copy of example data via pyopia.exampledata, even when another test elsewhere needs the same thing. Concretely, test_classify.py::test_match_to_database and #394's silcam_example_files fixture each separately download the same classifier model.
Proposed: promote the shared download/setup fixtures to a top-level conftest.py, and replace manual tempfile.TemporaryDirectory() usage with pytest's built-in tmp_path/tmp_path_factory fixtures across test_pipeline.py and test_classify.py. Should reduce redundant downloads and pipeline runs, and cut test-suite runtime.
Raised by @emlynjdavies on #394.
pyopia/tests/conftest.py(added in #394) uses@pytest.fixture(scope='session')to share expensive real setup (network download of the example model/image, a real end-to-endprocessrun) across multiple tests instead of repeating it per test.This differs from the existing pattern in
test_pipeline.pyandtest_classify.py, where each test function independently opens its owntempfile.TemporaryDirectory()and downloads its own copy of example data viapyopia.exampledata, even when another test elsewhere needs the same thing. Concretely,test_classify.py::test_match_to_databaseand #394'ssilcam_example_filesfixture each separately download the same classifier model.Proposed: promote the shared download/setup fixtures to a top-level
conftest.py, and replace manualtempfile.TemporaryDirectory()usage with pytest's built-intmp_path/tmp_path_factoryfixtures acrosstest_pipeline.pyandtest_classify.py. Should reduce redundant downloads and pipeline runs, and cut test-suite runtime.