From c0f2da8000f17be48e20affa0c8f64377d41b1f4 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 22 Nov 2023 17:32:46 +0000 Subject: [PATCH] fixup! test/test_repos: Refactor with parametrized fixtures --- tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 167786a..db56ca3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -35,6 +35,11 @@ def _src_name(src): "https://github.com/ppb/ppb-vector.git", ))) def project_src(request, tmp_path_factory): + """Provide a source tree, which is cached over the whole pytest run. + + This fixture is parameterized over all the source trees that are built during tests, + making any test (or fixture) that uses it parameterized itself. + """ if isinstance(request.param, Path): return request.param @@ -46,6 +51,7 @@ def project_src(request, tmp_path_factory): @pytest.fixture(scope="function") def project(project_src, tmp_path): + """Provide a fresh copy of a source tree, which is discarded after the current test.""" shutil.copytree(project_src, tmp_path, dirs_exist_ok=True) with chdir(tmp_path): yield tmp_path