diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2022-11-08 10:56:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-08 10:56:24 +0100 |
commit | e4218595de4f3a726bc45059a9e5219f416a8c84 (patch) | |
tree | 2f80a038dfe1903285749483a867a4df677733d4 | |
parent | c9561c5a0e962a7c17eb961d21bfd4f7728e656b (diff) | |
download | spack-e4218595de4f3a726bc45059a9e5219f416a8c84.tar.gz spack-e4218595de4f3a726bc45059a9e5219f416a8c84.tar.bz2 spack-e4218595de4f3a726bc45059a9e5219f416a8c84.tar.xz spack-e4218595de4f3a726bc45059a9e5219f416a8c84.zip |
Rework unit test to avoid tripping into concretization slowdown (#33749)
-rw-r--r-- | lib/spack/spack/test/concretize_preferences.py | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py index 56bda697fc..b0ae008a72 100644 --- a/lib/spack/spack/test/concretize_preferences.py +++ b/lib/spack/spack/test/concretize_preferences.py @@ -8,8 +8,6 @@ import stat import pytest -import archspec - import spack.config import spack.package_prefs import spack.repo @@ -105,28 +103,16 @@ class TestConcretizePreferences(object): update_packages("multivalue-variant", "variants", "foo=bar") assert_variant_values("multivalue-variant foo=*", foo=("bar",)) - def test_preferred_compilers(self): + @pytest.mark.parametrize( + "compiler_str,spec_str", + [("gcc@4.5.0", "mpileaks"), ("clang@12.0.0", "mpileaks"), ("gcc@4.5.0", "openmpi")], + ) + def test_preferred_compilers(self, compiler_str, spec_str): """Test preferred compilers are applied correctly""" - if spack.config.get("config:concretizer") == "original": - pytest.skip("Fixing the parser broke this test for the original concretizer.") - - # Need to make sure the test uses an available compiler - arch = spack.spec.ArchSpec(("test", "redhat6", archspec.cpu.host().name)) - - compiler_list = spack.compilers.compiler_specs_for_arch(arch) - assert compiler_list - - # Try the first available compiler - compiler = str(compiler_list[0]) - update_packages("mpileaks", "compiler", [compiler]) - spec = concretize("mpileaks") - assert spec.compiler == spack.spec.CompilerSpec(compiler) - - # Try the last available compiler - compiler = str(compiler_list[-1]) - update_packages("mpileaks", "compiler", [compiler]) - spec = concretize("mpileaks os=redhat6") - assert spec.compiler == spack.spec.CompilerSpec(compiler) + spec = spack.spec.Spec(spec_str) + update_packages(spec.name, "compiler", [compiler_str]) + spec.concretize() + assert spec.compiler == spack.spec.CompilerSpec(compiler_str) def test_preferred_target(self, mutable_mock_repo): """Test preferred targets are applied correctly""" |