diff --git a/test/run/test_sources.py b/test/run/test_sources.py index ee3438c5..b4d0981c 100644 --- a/test/run/test_sources.py +++ b/test/run/test_sources.py @@ -97,9 +97,15 @@ def check_case(source, case, store, libdir): raise ValueError(f"invalid expectation: {expects}") +@pytest.fixture(name="tmpdir") +def tmpdir_fixture(): + with tempfile.TemporaryDirectory() as tmp: + yield tmp + + @pytest.mark.skipif(not can_setup_netns(), reason="network namespace setup failed") @pytest.mark.parametrize("source,case", make_test_cases()) -def test_sources(source, case): +def test_sources(source, case, tmpdir): index = osbuild.meta.Index(os.curdir) sources = os.path.join(test.TestBase.locate_test_data(), "sources") @@ -113,8 +119,7 @@ def test_sources(source, case): src = osbuild.sources.Source(info, items, options) - with tempfile.TemporaryDirectory() as tmpdir, \ - osbuild.objectstore.ObjectStore(tmpdir) as store, \ + with osbuild.objectstore.ObjectStore(tmpdir) as store, \ fileServer(test.TestBase.locate_test_data()): check_case(src, case_options, store, index.path) check_case(src, case_options, store, index.path)