diff --git a/lib/spack/spack/test/cmd/pkg.py b/lib/spack/spack/test/cmd/pkg.py index 3e939d8dc3b..1e8ceec402e 100644 --- a/lib/spack/spack/test/cmd/pkg.py +++ b/lib/spack/spack/test/cmd/pkg.py @@ -111,6 +111,7 @@ def split(output): pkg = spack.main.SpackCommand("pkg") +@pytest.mark.requires_builtin("builtin repository path must exist") def test_builtin_repo(): assert spack.repo.builtin_repo() is spack.repo.PATH.get_repo("builtin") diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index b5b8e4d9825..9e6e72622de 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -2072,6 +2072,11 @@ def pytest_runtest_setup(item): if only_windows_marker and sys.platform != "win32": pytest.skip(*only_windows_marker.args) + # Skip tests marked "requires_builtin" if builtin repo is required + requires_builtin_marker = item.get_closest_marker(name="requires_builtin") + if requires_builtin_marker and not os.path.exists(spack.paths.packages_path): + pytest.skip(*requires_builtin_marker.args) + def _sequential_executor(*args, **kwargs): return spack.util.parallel.SequentialExecutor() diff --git a/pytest.ini b/pytest.ini index 79db8545913..eb84dbc8f0a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -14,3 +14,4 @@ markers = disable_clean_stage_check: avoid failing tests if there are leftover files in the stage area not_on_windows: mark tests that are skipped on Windows only_windows: mark tests that are skipped everywhere but Windows + requires_builtin: tests that require the builtin repository