Revert "Testing: fix unintended interactions between tests (#16003)" (#16420)

This was breaking tests on develop.
This commit is contained in:
Peter Scheibel 2020-05-01 13:39:43 -07:00 committed by GitHub
parent 31d12d380f
commit 40df44e021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 23 deletions

View File

@ -159,19 +159,7 @@ def compiler_list(args):
tty.msg("Available compilers")
index = index_by(spack.compilers.all_compilers(scope=args.scope),
lambda c: (c.spec.name, c.operating_system, c.target))
# For a container, take each element which does not evaluate to false and
# convert it to a string. For elements which evaluate to False (e.g. None)
# convert them to '' (in which case it still evaluates to False but is a
# string type). Tuples produced by this are guaranteed to be comparable in
# Python 3
convert_str = (
lambda tuple_container:
tuple(str(x) if x else '' for x in tuple_container))
index_str_keys = list(
(convert_str(x), y) for x, y in index.items())
ordered_sections = sorted(index_str_keys, key=lambda item: item[0])
ordered_sections = sorted(index.items(), key=lambda item: item[0])
for i, (key, compilers) in enumerate(ordered_sections):
if i >= 1:
print()

View File

@ -12,6 +12,7 @@
from spack.concretize import find_spec, NoValidVersionError
from spack.error import SpecError
from spack.package_prefs import PackagePrefs
from spack.spec import Spec, CompilerSpec, ConflictsInSpecError
from spack.version import ver
from spack.util.mock_package import MockPackageMultiRepo
@ -102,6 +103,8 @@ def current_host(request, monkeypatch):
monkeypatch.setattr(spack.platforms.test.Test, 'default', cpu)
yield target
else:
# There's a cache that needs to be cleared for unit tests
PackagePrefs._packages_config_cache = None
with spack.config.override('packages:all', {'target': [cpu]}):
yield target
@ -109,10 +112,7 @@ def current_host(request, monkeypatch):
spack.architecture.get_platform.cache.clear()
# This must use the mutable_config fixture because the test
# adjusting_default_target_based_on_compiler uses the current_host fixture,
# which changes the config.
@pytest.mark.usefixtures('mutable_config', 'mock_packages')
@pytest.mark.usefixtures('config', 'mock_packages')
class TestConcretize(object):
def test_concretize(self, spec):
check_concretize(spec)

View File

@ -100,7 +100,7 @@ def test_preferred_compilers(self):
# Try the last available compiler
compiler = str(compiler_list[-1])
update_packages('mpileaks', 'compiler', [compiler])
spec = concretize('mpileaks os=redhat6 target=x86')
spec = concretize('mpileaks')
assert spec.compiler == spack.spec.CompilerSpec(compiler)
def test_preferred_target(self, mutable_mock_repo):

View File

@ -423,13 +423,13 @@ def config(mock_configuration):
@pytest.fixture(scope='function')
def mutable_config(tmpdir_factory, configuration_dir):
def mutable_config(tmpdir_factory, configuration_dir, monkeypatch):
"""Like config, but tests can modify the configuration."""
mutable_dir = tmpdir_factory.mktemp('mutable_config').join('tmp')
configuration_dir.copy(mutable_dir)
cfg = spack.config.Configuration(
*[spack.config.ConfigScope(name, str(mutable_dir.join(name)))
*[spack.config.ConfigScope(name, str(mutable_dir))
for name in ['site', 'system', 'user']])
with use_configuration(cfg):

View File

@ -1,7 +1,4 @@
packages:
all:
providers:
mpi: [openmpi, mpich]
externaltool:
buildable: False
paths: