diff options
-rw-r--r-- | lib/spack/spack/architecture.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 72cb3e57cc..494563b0cb 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -441,6 +441,7 @@ class Arch(object): return arch_for_spec(spec) +@memoized def get_platform(platform_name): """Returns a platform object that corresponds to the given name.""" platform_list = all_platforms() diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index e0774909f4..4b17e755ed 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -94,6 +94,10 @@ def current_host(request, monkeypatch): # preferred target via packages.yaml cpu, _, is_preference = request.param.partition('-') target = llnl.util.cpu.targets[cpu] + + # this function is memoized, so clear its state for testing + spack.architecture.get_platform.cache.clear() + if not is_preference: monkeypatch.setattr(llnl.util.cpu, 'host', lambda: target) monkeypatch.setattr(spack.platforms.test.Test, 'default', cpu) @@ -104,6 +108,9 @@ def current_host(request, monkeypatch): with spack.config.override('packages:all', {'target': [cpu]}): yield target + # clear any test values fetched + spack.architecture.get_platform.cache.clear() + @pytest.mark.usefixtures('config', 'mock_packages') class TestConcretize(object): |