tests/compilers/libraries.py: use mock packages (#50442)

This commit is contained in:
Tamara Dahlgren 2025-05-15 22:49:07 -07:00 committed by GitHub
parent 5e617be0ad
commit 56df6b414d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,11 +28,14 @@ def call_compiler(exe, *args, **kwargs):
@pytest.fixture() @pytest.fixture()
def mock_gcc(config): def mock_gcc(config):
compilers = spack.compilers.config.all_compilers_from(configuration=config) compilers = spack.compilers.config.all_compilers_from(configuration=config)
assert compilers, "No compilers available"
compilers.sort(key=lambda x: (x.name == "gcc", x.version)) compilers.sort(key=lambda x: (x.name == "gcc", x.version))
# Deepcopy is used to avoid more boilerplate when changing the "extra_attributes" # Deepcopy is used to avoid more boilerplate when changing the "extra_attributes"
return copy.deepcopy(compilers[-1]) return copy.deepcopy(compilers[-1])
@pytest.mark.usefixtures("mock_packages")
class TestCompilerPropertyDetector: class TestCompilerPropertyDetector:
@pytest.mark.parametrize( @pytest.mark.parametrize(
"language,flagname", "language,flagname",