Skip to content

Commit 40df44e

Browse files
authored
Revert "Testing: fix unintended interactions between tests (spack#16003)" (spack#16420)
This was breaking tests on develop.
1 parent 31d12d3 commit 40df44e

5 files changed

Lines changed: 8 additions & 23 deletions

File tree

lib/spack/spack/cmd/compiler.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,7 @@ def compiler_list(args):
159159
tty.msg("Available compilers")
160160
index = index_by(spack.compilers.all_compilers(scope=args.scope),
161161
lambda c: (c.spec.name, c.operating_system, c.target))
162-
163-
# For a container, take each element which does not evaluate to false and
164-
# convert it to a string. For elements which evaluate to False (e.g. None)
165-
# convert them to '' (in which case it still evaluates to False but is a
166-
# string type). Tuples produced by this are guaranteed to be comparable in
167-
# Python 3
168-
convert_str = (
169-
lambda tuple_container:
170-
tuple(str(x) if x else '' for x in tuple_container))
171-
172-
index_str_keys = list(
173-
(convert_str(x), y) for x, y in index.items())
174-
ordered_sections = sorted(index_str_keys, key=lambda item: item[0])
162+
ordered_sections = sorted(index.items(), key=lambda item: item[0])
175163
for i, (key, compilers) in enumerate(ordered_sections):
176164
if i >= 1:
177165
print()

lib/spack/spack/test/concretize.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from spack.concretize import find_spec, NoValidVersionError
1414
from spack.error import SpecError
15+
from spack.package_prefs import PackagePrefs
1516
from spack.spec import Spec, CompilerSpec, ConflictsInSpecError
1617
from spack.version import ver
1718
from spack.util.mock_package import MockPackageMultiRepo
@@ -102,17 +103,16 @@ def current_host(request, monkeypatch):
102103
monkeypatch.setattr(spack.platforms.test.Test, 'default', cpu)
103104
yield target
104105
else:
106+
# There's a cache that needs to be cleared for unit tests
107+
PackagePrefs._packages_config_cache = None
105108
with spack.config.override('packages:all', {'target': [cpu]}):
106109
yield target
107110

108111
# clear any test values fetched
109112
spack.architecture.get_platform.cache.clear()
110113

111114

112-
# This must use the mutable_config fixture because the test
113-
# adjusting_default_target_based_on_compiler uses the current_host fixture,
114-
# which changes the config.
115-
@pytest.mark.usefixtures('mutable_config', 'mock_packages')
115+
@pytest.mark.usefixtures('config', 'mock_packages')
116116
class TestConcretize(object):
117117
def test_concretize(self, spec):
118118
check_concretize(spec)

lib/spack/spack/test/concretize_preferences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_preferred_compilers(self):
100100
# Try the last available compiler
101101
compiler = str(compiler_list[-1])
102102
update_packages('mpileaks', 'compiler', [compiler])
103-
spec = concretize('mpileaks os=redhat6 target=x86')
103+
spec = concretize('mpileaks')
104104
assert spec.compiler == spack.spec.CompilerSpec(compiler)
105105

106106
def test_preferred_target(self, mutable_mock_repo):

lib/spack/spack/test/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,13 @@ def config(mock_configuration):
423423

424424

425425
@pytest.fixture(scope='function')
426-
def mutable_config(tmpdir_factory, configuration_dir):
426+
def mutable_config(tmpdir_factory, configuration_dir, monkeypatch):
427427
"""Like config, but tests can modify the configuration."""
428428
mutable_dir = tmpdir_factory.mktemp('mutable_config').join('tmp')
429429
configuration_dir.copy(mutable_dir)
430430

431431
cfg = spack.config.Configuration(
432-
*[spack.config.ConfigScope(name, str(mutable_dir.join(name)))
432+
*[spack.config.ConfigScope(name, str(mutable_dir))
433433
for name in ['site', 'system', 'user']])
434434

435435
with use_configuration(cfg):

lib/spack/spack/test/data/config/packages.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
packages:
2-
all:
3-
providers:
4-
mpi: [openmpi, mpich]
52
externaltool:
63
buildable: False
74
paths:

0 commit comments

Comments
 (0)