summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/test/cmd/config.py8
-rw-r--r--lib/spack/spack/test/concretize.py2
-rw-r--r--lib/spack/spack/test/config.py51
-rw-r--r--lib/spack/spack/test/conftest.py2
4 files changed, 32 insertions, 31 deletions
diff --git a/lib/spack/spack/test/cmd/config.py b/lib/spack/spack/test/cmd/config.py
index 0d6cc7ec40..b8148c519b 100644
--- a/lib/spack/spack/test/cmd/config.py
+++ b/lib/spack/spack/test/cmd/config.py
@@ -14,13 +14,13 @@ from spack.main import SpackCommand
config = SpackCommand('config')
-def test_get_config_scope(mock_config):
+def test_get_config_scope(mock_low_high_config):
assert config('get', 'compilers').strip() == 'compilers: {}'
-def test_get_config_scope_merged(mock_config):
- low_path = mock_config.scopes['low'].path
- high_path = mock_config.scopes['high'].path
+def test_get_config_scope_merged(mock_low_high_config):
+ low_path = mock_low_high_config.scopes['low'].path
+ high_path = mock_low_high_config.scopes['high'].path
mkdirp(low_path)
mkdirp(high_path)
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 483cae7809..269f28b7f4 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -302,7 +302,7 @@ class TestConcretize(object):
with pytest.raises(spack.spec.MultipleProviderError):
s.concretize()
- def test_no_matching_compiler_specs(self, mock_config):
+ def test_no_matching_compiler_specs(self, mock_low_high_config):
# only relevant when not building compilers as needed
with spack.concretize.enable_compiler_existence_check():
s = Spec('a %gcc@0.0.0')
diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py
index 605c37d468..cd9890014e 100644
--- a/lib/spack/spack/test/config.py
+++ b/lib/spack/spack/test/config.py
@@ -203,7 +203,7 @@ def compiler_specs():
return CompilerSpecs(a=a, b=b)
-def test_write_key_in_memory(mock_config, compiler_specs):
+def test_write_key_in_memory(mock_low_high_config, compiler_specs):
# Write b_comps "on top of" a_comps.
spack.config.set('compilers', a_comps['compilers'], scope='low')
spack.config.set('compilers', b_comps['compilers'], scope='high')
@@ -213,7 +213,7 @@ def test_write_key_in_memory(mock_config, compiler_specs):
check_compiler_config(b_comps['compilers'], *compiler_specs.b)
-def test_write_key_to_disk(mock_config, compiler_specs):
+def test_write_key_to_disk(mock_low_high_config, compiler_specs):
# Write b_comps "on top of" a_comps.
spack.config.set('compilers', a_comps['compilers'], scope='low')
spack.config.set('compilers', b_comps['compilers'], scope='high')
@@ -226,7 +226,7 @@ def test_write_key_to_disk(mock_config, compiler_specs):
check_compiler_config(b_comps['compilers'], *compiler_specs.b)
-def test_write_to_same_priority_file(mock_config, compiler_specs):
+def test_write_to_same_priority_file(mock_low_high_config, compiler_specs):
# Write b_comps in the same file as a_comps.
spack.config.set('compilers', a_comps['compilers'], scope='low')
spack.config.set('compilers', b_comps['compilers'], scope='low')
@@ -247,7 +247,7 @@ repos_high = {'repos': ["/some/other/path"]}
# repos
-def test_write_list_in_memory(mock_config):
+def test_write_list_in_memory(mock_low_high_config):
spack.config.set('repos', repos_low['repos'], scope='low')
spack.config.set('repos', repos_high['repos'], scope='high')
@@ -255,7 +255,7 @@ def test_write_list_in_memory(mock_config):
assert config == repos_high['repos'] + repos_low['repos']
-def test_substitute_config_variables(mock_config):
+def test_substitute_config_variables(mock_low_high_config):
prefix = spack.paths.prefix.lstrip('/')
assert os.path.join(
@@ -315,7 +315,7 @@ packages_merge_high = {
@pytest.mark.regression('7924')
-def test_merge_with_defaults(mock_config, write_config_file):
+def test_merge_with_defaults(mock_low_high_config, write_config_file):
"""This ensures that specified preferences merge with defaults as
expected. Originally all defaults were initialized with the
exact same object, which led to aliasing problems. Therefore
@@ -331,14 +331,14 @@ def test_merge_with_defaults(mock_config, write_config_file):
assert cfg['baz']['version'] == ['c']
-def test_substitute_user(mock_config):
+def test_substitute_user(mock_low_high_config):
user = getpass.getuser()
assert '/foo/bar/' + user + '/baz' == canonicalize_path(
'/foo/bar/$user/baz'
)
-def test_substitute_tempdir(mock_config):
+def test_substitute_tempdir(mock_low_high_config):
tempdir = tempfile.gettempdir()
assert tempdir == canonicalize_path('$tempdir')
assert tempdir + '/foo/bar/baz' == canonicalize_path(
@@ -346,12 +346,12 @@ def test_substitute_tempdir(mock_config):
)
-def test_read_config(mock_config, write_config_file):
+def test_read_config(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
assert spack.config.get('config') == config_low['config']
-def test_read_config_override_all(mock_config, write_config_file):
+def test_read_config_override_all(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
write_config_file('config', config_override_all, 'high')
assert spack.config.get('config') == {
@@ -359,7 +359,7 @@ def test_read_config_override_all(mock_config, write_config_file):
}
-def test_read_config_override_key(mock_config, write_config_file):
+def test_read_config_override_key(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
write_config_file('config', config_override_key, 'high')
assert spack.config.get('config') == {
@@ -368,7 +368,7 @@ def test_read_config_override_key(mock_config, write_config_file):
}
-def test_read_config_merge_list(mock_config, write_config_file):
+def test_read_config_merge_list(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
write_config_file('config', config_merge_list, 'high')
assert spack.config.get('config') == {
@@ -377,7 +377,7 @@ def test_read_config_merge_list(mock_config, write_config_file):
}
-def test_read_config_override_list(mock_config, write_config_file):
+def test_read_config_override_list(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
write_config_file('config', config_override_list, 'high')
assert spack.config.get('config') == {
@@ -386,33 +386,34 @@ def test_read_config_override_list(mock_config, write_config_file):
}
-def test_internal_config_update(mock_config, write_config_file):
+def test_internal_config_update(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
- before = mock_config.get('config')
+ before = mock_low_high_config.get('config')
assert before['install_tree'] == 'install_tree_path'
# add an internal configuration scope
scope = spack.config.InternalConfigScope('command_line')
assert 'InternalConfigScope' in repr(scope)
- mock_config.push_scope(scope)
+ mock_low_high_config.push_scope(scope)
- command_config = mock_config.get('config', scope='command_line')
+ command_config = mock_low_high_config.get('config', scope='command_line')
command_config['install_tree'] = 'foo/bar'
- mock_config.set('config', command_config, scope='command_line')
+ mock_low_high_config.set('config', command_config, scope='command_line')
- after = mock_config.get('config')
+ after = mock_low_high_config.get('config')
assert after['install_tree'] == 'foo/bar'
-def test_internal_config_filename(mock_config, write_config_file):
+def test_internal_config_filename(mock_low_high_config, write_config_file):
write_config_file('config', config_low, 'low')
- mock_config.push_scope(spack.config.InternalConfigScope('command_line'))
+ mock_low_high_config.push_scope(
+ spack.config.InternalConfigScope('command_line'))
with pytest.raises(NotImplementedError):
- mock_config.get_config_filename('command_line', 'config')
+ mock_low_high_config.get_config_filename('command_line', 'config')
def test_mark_internal():
@@ -585,7 +586,7 @@ mirrors:
assert "mirrors.yaml:5" in str(e)
-def test_bad_config_section(mock_config):
+def test_bad_config_section(mock_low_high_config):
"""Test that getting or setting a bad section gives an error."""
with pytest.raises(spack.config.ConfigSectionError):
spack.config.set('foobar', 'foobar')
@@ -595,7 +596,7 @@ def test_bad_config_section(mock_config):
@pytest.mark.skipif(os.getuid() == 0, reason='user is root')
-def test_bad_command_line_scopes(tmpdir, mock_config):
+def test_bad_command_line_scopes(tmpdir, mock_low_high_config):
cfg = spack.config.Configuration()
with tmpdir.as_cwd():
@@ -844,7 +845,7 @@ compilers:
@pytest.mark.regression('13045')
def test_dotkit_in_config_does_not_raise(
- mock_config, write_config_file, capsys
+ mock_low_high_config, write_config_file, capsys
):
write_config_file('config',
{'config': {'module_roots': {'dotkit': '/some/path'}}},
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 26cb0f453d..759b399d86 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -430,7 +430,7 @@ def mutable_config(tmpdir_factory, configuration_dir, monkeypatch):
@pytest.fixture()
-def mock_config(tmpdir):
+def mock_low_high_config(tmpdir):
"""Mocks two configuration scopes: 'low' and 'high'."""
config = spack.config.Configuration(
*[spack.config.ConfigScope(name, str(tmpdir.join(name)))