From 03224e52d221e6e833072f3a58cc65593a4bf97f Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Sun, 13 Nov 2022 13:09:22 +0100 Subject: Speed-up bootstrap and architecture unit tests (#33865) * Speed-up bootstrap mirror unit test The unit test doesn't need to concretize, since it checks only metadata for the mirror. * architecture.py: use "default_mock_concretization" for slow test --- lib/spack/spack/test/architecture.py | 4 ++-- lib/spack/spack/test/cmd/bootstrap.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py index ef95e4b383..3a49f77a7a 100644 --- a/lib/spack/spack/test/architecture.py +++ b/lib/spack/spack/test/architecture.py @@ -70,11 +70,11 @@ def test_user_input_combination(config, target_str, os_str): assert spec.architecture.target == TEST_PLATFORM.target(target_str) -def test_default_os_and_target(config): +def test_default_os_and_target(default_mock_concretization): """Test that is we don't specify `os=` or `target=` we get the default values after concretization. """ - spec = spack.spec.Spec("libelf").concretized() + spec = default_mock_concretization("libelf") assert spec.architecture.os == str(TEST_PLATFORM.operating_system("default_os")) assert spec.architecture.target == TEST_PLATFORM.target("default_target") diff --git a/lib/spack/spack/test/cmd/bootstrap.py b/lib/spack/spack/test/cmd/bootstrap.py index 81ba1e2cee..61b8b913c8 100644 --- a/lib/spack/spack/test/cmd/bootstrap.py +++ b/lib/spack/spack/test/cmd/bootstrap.py @@ -182,6 +182,7 @@ def test_bootstrap_mirror_metadata(mutable_config, linux_os, monkeypatch, tmpdir """ old_create = spack.mirror.create monkeypatch.setattr(spack.mirror, "create", lambda p, s: old_create(p, [])) + monkeypatch.setattr(spack.spec.Spec, "concretized", lambda p: p) # Create the mirror in a temporary folder compilers = [ -- cgit v1.2.3-70-g09d2