summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-04-28 22:48:26 -0700
committerscheibelp <scheibel1@llnl.gov>2018-05-17 14:10:30 -0700
commit2a09b627c935577342d7a8cfd51db88fbf2bffa6 (patch)
treee0edff3276494d0f2c845fc73c79c08540476f96 /lib
parentd1903f3bf3740c0e4930dae1e89a2322a7541f47 (diff)
downloadspack-2a09b627c935577342d7a8cfd51db88fbf2bffa6.tar.gz
spack-2a09b627c935577342d7a8cfd51db88fbf2bffa6.tar.bz2
spack-2a09b627c935577342d7a8cfd51db88fbf2bffa6.tar.xz
spack-2a09b627c935577342d7a8cfd51db88fbf2bffa6.zip
tests: rename builtin_mock to "mock_packages" for clarity.
- rename `builtin_mock` and `refresh_builtin_mock` to the more clear `mock_packages` and `mutable_mock_packages`
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/build_systems.py4
-rw-r--r--lib/spack/spack/test/cmd/blame.py8
-rw-r--r--lib/spack/spack/test/cmd/clean.py2
-rw-r--r--lib/spack/spack/test/cmd/dependencies.py8
-rw-r--r--lib/spack/spack/test/cmd/dependents.py8
-rw-r--r--lib/spack/spack/test/cmd/graph.py12
-rw-r--r--lib/spack/spack/test/cmd/install.py34
-rw-r--r--lib/spack/spack/test/cmd/test_compiler_cmd.py2
-rw-r--r--lib/spack/spack/test/cmd/view.py16
-rw-r--r--lib/spack/spack/test/concretize.py4
-rw-r--r--lib/spack/spack/test/concretize_preferences.py4
-rw-r--r--lib/spack/spack/test/conftest.py22
-rw-r--r--lib/spack/spack/test/directory_layout.py6
-rw-r--r--lib/spack/spack/test/git_fetch.py2
-rw-r--r--lib/spack/spack/test/graph.py8
-rw-r--r--lib/spack/spack/test/hg_fetch.py2
-rw-r--r--lib/spack/spack/test/install.py2
-rw-r--r--lib/spack/spack/test/mirror.py2
-rw-r--r--lib/spack/spack/test/modules/dotkit.py2
-rw-r--r--lib/spack/spack/test/modules/lmod.py2
-rw-r--r--lib/spack/spack/test/modules/tcl.py2
-rw-r--r--lib/spack/spack/test/multimethod.py20
-rw-r--r--lib/spack/spack/test/optional_deps.py4
-rw-r--r--lib/spack/spack/test/package_hash.py14
-rw-r--r--lib/spack/spack/test/packages.py2
-rw-r--r--lib/spack/spack/test/patch.py10
-rw-r--r--lib/spack/spack/test/provider_index.py10
-rw-r--r--lib/spack/spack/test/spec_dag.py2
-rw-r--r--lib/spack/spack/test/spec_semantics.py2
-rw-r--r--lib/spack/spack/test/spec_yaml.py14
-rw-r--r--lib/spack/spack/test/stage.py2
-rw-r--r--lib/spack/spack/test/svn_fetch.py2
-rw-r--r--lib/spack/spack/test/url_fetch.py4
33 files changed, 117 insertions, 121 deletions
diff --git a/lib/spack/spack/test/build_systems.py b/lib/spack/spack/test/build_systems.py
index 983a474310..b90a084d09 100644
--- a/lib/spack/spack/test/build_systems.py
+++ b/lib/spack/spack/test/build_systems.py
@@ -30,7 +30,7 @@ from spack.build_environment import get_std_cmake_args
from spack.spec import Spec
-def test_cmake_std_args(config, builtin_mock):
+def test_cmake_std_args(config, mock_packages):
# Call the function on a CMakePackage instance
s = Spec('cmake-client')
s.concretize()
@@ -44,7 +44,7 @@ def test_cmake_std_args(config, builtin_mock):
assert get_std_cmake_args(pkg)
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestAutotoolsPackage(object):
def test_with_or_without(self):
diff --git a/lib/spack/spack/test/cmd/blame.py b/lib/spack/spack/test/cmd/blame.py
index 7c793f0694..3639e2563e 100644
--- a/lib/spack/spack/test/cmd/blame.py
+++ b/lib/spack/spack/test/cmd/blame.py
@@ -38,7 +38,7 @@ pytestmark = pytest.mark.skipif(
blame = SpackCommand('blame')
-def test_blame_by_modtime(builtin_mock):
+def test_blame_by_modtime(mock_packages):
"""Sanity check the blame command to make sure it works."""
out = blame('--time', 'mpich')
assert 'LAST_COMMIT' in out
@@ -46,7 +46,7 @@ def test_blame_by_modtime(builtin_mock):
assert 'EMAIL' in out
-def test_blame_by_percent(builtin_mock):
+def test_blame_by_percent(mock_packages):
"""Sanity check the blame command to make sure it works."""
out = blame('--percent', 'mpich')
assert 'LAST_COMMIT' in out
@@ -54,7 +54,7 @@ def test_blame_by_percent(builtin_mock):
assert 'EMAIL' in out
-def test_blame_file(builtin_mock):
+def test_blame_file(mock_packages):
"""Sanity check the blame command to make sure it works."""
with working_dir(spack.paths.prefix):
out = blame('bin/spack')
@@ -63,7 +63,7 @@ def test_blame_file(builtin_mock):
assert 'EMAIL' in out
-def test_blame_by_git(builtin_mock, capfd):
+def test_blame_by_git(mock_packages, capfd):
"""Sanity check the blame command to make sure it works."""
with capfd.disabled():
out = blame('--git', 'mpich')
diff --git a/lib/spack/spack/test/cmd/clean.py b/lib/spack/spack/test/cmd/clean.py
index 3bc5e4c184..3e189531ff 100644
--- a/lib/spack/spack/test/cmd/clean.py
+++ b/lib/spack/spack/test/cmd/clean.py
@@ -50,7 +50,7 @@ def mock_calls_for_clean(monkeypatch):
@pytest.mark.usefixtures(
- 'builtin_mock', 'config', 'mock_calls_for_clean'
+ 'mock_packages', 'config', 'mock_calls_for_clean'
)
@pytest.mark.parametrize('command_line,counters', [
('mpileaks', [1, 0, 0, 0]),
diff --git a/lib/spack/spack/test/cmd/dependencies.py b/lib/spack/spack/test/cmd/dependencies.py
index f6ce5c3602..015eac589c 100644
--- a/lib/spack/spack/test/cmd/dependencies.py
+++ b/lib/spack/spack/test/cmd/dependencies.py
@@ -37,14 +37,14 @@ mpis = ['mpich', 'mpich2', 'multi-provider-mpi', 'zmpi']
mpi_deps = ['fake']
-def test_immediate_dependencies(builtin_mock):
+def test_immediate_dependencies(mock_packages):
out = dependencies('mpileaks')
actual = set(re.split(r'\s+', out.strip()))
expected = set(['callpath'] + mpis)
assert expected == actual
-def test_transitive_dependencies(builtin_mock):
+def test_transitive_dependencies(mock_packages):
out = dependencies('--transitive', 'mpileaks')
actual = set(re.split(r'\s+', out.strip()))
expected = set(
@@ -53,7 +53,7 @@ def test_transitive_dependencies(builtin_mock):
@pytest.mark.db
-def test_immediate_installed_dependencies(builtin_mock, database):
+def test_immediate_installed_dependencies(mock_packages, database):
with color_when(False):
out = dependencies('--installed', 'mpileaks^mpich')
@@ -67,7 +67,7 @@ def test_immediate_installed_dependencies(builtin_mock, database):
@pytest.mark.db
-def test_transitive_installed_dependencies(builtin_mock, database):
+def test_transitive_installed_dependencies(mock_packages, database):
with color_when(False):
out = dependencies('--installed', '--transitive', 'mpileaks^zmpi')
diff --git a/lib/spack/spack/test/cmd/dependents.py b/lib/spack/spack/test/cmd/dependents.py
index 2ed4786c05..c6a5b01111 100644
--- a/lib/spack/spack/test/cmd/dependents.py
+++ b/lib/spack/spack/test/cmd/dependents.py
@@ -34,14 +34,14 @@ from spack.main import SpackCommand
dependents = SpackCommand('dependents')
-def test_immediate_dependents(builtin_mock):
+def test_immediate_dependents(mock_packages):
out = dependents('libelf')
actual = set(re.split(r'\s+', out.strip()))
assert actual == set(['dyninst', 'libdwarf',
'patch-a-dependency', 'patch-several-dependencies'])
-def test_transitive_dependents(builtin_mock):
+def test_transitive_dependents(mock_packages):
out = dependents('--transitive', 'libelf')
actual = set(re.split(r'\s+', out.strip()))
assert actual == set(
@@ -51,7 +51,7 @@ def test_transitive_dependents(builtin_mock):
@pytest.mark.db
-def test_immediate_installed_dependents(builtin_mock, database):
+def test_immediate_installed_dependents(mock_packages, database):
with color_when(False):
out = dependents('--installed', 'libelf')
@@ -68,7 +68,7 @@ def test_immediate_installed_dependents(builtin_mock, database):
@pytest.mark.db
-def test_transitive_installed_dependents(builtin_mock, database):
+def test_transitive_installed_dependents(mock_packages, database):
with color_when(False):
out = dependents('--installed', '--transitive', 'fake')
diff --git a/lib/spack/spack/test/cmd/graph.py b/lib/spack/spack/test/cmd/graph.py
index 0fc18e8f71..a5776e4ce2 100644
--- a/lib/spack/spack/test/cmd/graph.py
+++ b/lib/spack/spack/test/cmd/graph.py
@@ -31,35 +31,35 @@ graph = SpackCommand('graph')
@pytest.mark.db
-@pytest.mark.usefixtures('builtin_mock', 'database')
+@pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_ascii():
"""Tests spack graph --ascii"""
graph('--ascii', 'dt-diamond')
@pytest.mark.db
-@pytest.mark.usefixtures('builtin_mock', 'database')
+@pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_dot():
"""Tests spack graph --dot"""
graph('--dot', 'dt-diamond')
@pytest.mark.db
-@pytest.mark.usefixtures('builtin_mock', 'database')
+@pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_normalize():
"""Tests spack graph --normalize"""
graph('--normalize', 'dt-diamond')
@pytest.mark.db
-@pytest.mark.usefixtures('builtin_mock', 'database')
+@pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_static():
"""Tests spack graph --static"""
graph('--static', 'dt-diamond')
@pytest.mark.db
-@pytest.mark.usefixtures('builtin_mock', 'database')
+@pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_installed():
"""Tests spack graph --installed"""
@@ -70,7 +70,7 @@ def test_graph_installed():
@pytest.mark.db
-@pytest.mark.usefixtures('builtin_mock', 'database')
+@pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_deptype():
"""Tests spack graph --deptype"""
graph('--deptype', 'all', 'dt-diamond')
diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py
index f5252fe4b1..185a08f4f6 100644
--- a/lib/spack/spack/test/cmd/install.py
+++ b/lib/spack/spack/test/cmd/install.py
@@ -59,7 +59,7 @@ def noop_install(monkeypatch):
def test_install_package_and_dependency(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
with tmpdir.as_cwd():
@@ -76,7 +76,7 @@ def test_install_package_and_dependency(
@pytest.mark.disable_clean_stage_check
-def test_install_runtests_notests(monkeypatch, builtin_mock, install_mockery):
+def test_install_runtests_notests(monkeypatch, mock_packages, install_mockery):
def check(pkg):
assert not pkg.run_tests
monkeypatch.setattr(spack.package.PackageBase, 'unit_test_check', check)
@@ -84,7 +84,7 @@ def test_install_runtests_notests(monkeypatch, builtin_mock, install_mockery):
@pytest.mark.disable_clean_stage_check
-def test_install_runtests_root(monkeypatch, builtin_mock, install_mockery):
+def test_install_runtests_root(monkeypatch, mock_packages, install_mockery):
def check(pkg):
assert pkg.run_tests == (pkg.name == 'dttop')
@@ -93,7 +93,7 @@ def test_install_runtests_root(monkeypatch, builtin_mock, install_mockery):
@pytest.mark.disable_clean_stage_check
-def test_install_runtests_all(monkeypatch, builtin_mock, install_mockery):
+def test_install_runtests_all(monkeypatch, mock_packages, install_mockery):
def check(pkg):
assert pkg.run_tests
@@ -103,7 +103,7 @@ def test_install_runtests_all(monkeypatch, builtin_mock, install_mockery):
def test_install_package_already_installed(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
with tmpdir.as_cwd():
@@ -153,7 +153,7 @@ def test_package_output(tmpdir, capsys, install_mockery, mock_fetch):
@pytest.mark.disable_clean_stage_check
-def test_install_output_on_build_error(builtin_mock, mock_archive, mock_fetch,
+def test_install_output_on_build_error(mock_packages, mock_archive, mock_fetch,
config, install_mockery, capfd):
# capfd interferes with Spack's capturing
with capfd.disabled():
@@ -165,7 +165,7 @@ def test_install_output_on_build_error(builtin_mock, mock_archive, mock_fetch,
@pytest.mark.disable_clean_stage_check
-def test_install_output_on_python_error(builtin_mock, mock_archive, mock_fetch,
+def test_install_output_on_python_error(mock_packages, mock_archive, mock_fetch,
config, install_mockery):
out = install('failing-build', fail_on_error=False)
assert isinstance(install.error, spack.build_environment.ChildError)
@@ -175,7 +175,7 @@ def test_install_output_on_python_error(builtin_mock, mock_archive, mock_fetch,
@pytest.mark.disable_clean_stage_check
def test_install_with_source(
- builtin_mock, mock_archive, mock_fetch, config, install_mockery):
+ mock_packages, mock_archive, mock_fetch, config, install_mockery):
"""Verify that source has been copied into place."""
install('--source', '--keep-stage', 'trivial-install-test-package')
spec = Spec('trivial-install-test-package').concretized()
@@ -186,7 +186,7 @@ def test_install_with_source(
@pytest.mark.disable_clean_stage_check
-def test_show_log_on_error(builtin_mock, mock_archive, mock_fetch,
+def test_show_log_on_error(mock_packages, mock_archive, mock_fetch,
config, install_mockery, capfd):
"""Make sure --show-log-on-error works."""
with capfd.disabled():
@@ -202,7 +202,7 @@ def test_show_log_on_error(builtin_mock, mock_archive, mock_fetch,
def test_install_overwrite(
- builtin_mock, mock_archive, mock_fetch, config, install_mockery
+ mock_packages, mock_archive, mock_fetch, config, install_mockery
):
# It's not possible to overwrite something that is not yet installed
with pytest.raises(AssertionError):
@@ -237,7 +237,7 @@ def test_install_overwrite(
@pytest.mark.usefixtures(
- 'builtin_mock', 'mock_archive', 'mock_fetch', 'config', 'install_mockery',
+ 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery',
)
def test_install_conflicts(conflict_spec):
# Make sure that spec with conflicts raises a SpackError
@@ -246,7 +246,7 @@ def test_install_conflicts(conflict_spec):
@pytest.mark.usefixtures(
- 'builtin_mock', 'mock_archive', 'mock_fetch', 'config', 'install_mockery',
+ 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery',
)
def test_install_invalid_spec(invalid_spec):
# Make sure that invalid specs raise a SpackError
@@ -284,7 +284,7 @@ def test_install_from_file(spec, concretize, error_code, tmpdir):
@pytest.mark.disable_clean_stage_check
@pytest.mark.usefixtures(
- 'builtin_mock', 'mock_archive', 'mock_fetch', 'config', 'install_mockery'
+ 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery'
)
@pytest.mark.parametrize('exc_typename,msg', [
('RuntimeError', 'something weird happened'),
@@ -317,7 +317,7 @@ def test_junit_output_with_failures(tmpdir, exc_typename, msg):
@pytest.mark.disable_clean_stage_check
@pytest.mark.usefixtures(
- 'builtin_mock', 'mock_archive', 'mock_fetch', 'config', 'install_mockery'
+ 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery'
)
@pytest.mark.parametrize('exc_typename,msg', [
('RuntimeError', 'something weird happened'),
@@ -379,10 +379,8 @@ def test_install_mix_cli_and_files(clispecs, filespecs, tmpdir):
assert install.returncode == 0
-@pytest.mark.usefixtures(
- 'builtin_mock', 'mock_archive', 'mock_fetch', 'config', 'install_mockery'
-)
-def test_extra_files_are_archived():
+def test_extra_files_are_archived(mock_packages, mock_archive, mock_fetch,
+ config, install_mockery):
s = Spec('archive-files')
s.concretize()
diff --git a/lib/spack/spack/test/cmd/test_compiler_cmd.py b/lib/spack/spack/test/cmd/test_compiler_cmd.py
index 7463047853..622342bdb0 100644
--- a/lib/spack/spack/test/cmd/test_compiler_cmd.py
+++ b/lib/spack/spack/test/cmd/test_compiler_cmd.py
@@ -63,7 +63,7 @@ done
return str(tmpdir)
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestCompilerCommand(object):
def test_compiler_remove(self):
diff --git a/lib/spack/spack/test/cmd/view.py b/lib/spack/spack/test/cmd/view.py
index 252ec24f4e..515e717363 100644
--- a/lib/spack/spack/test/cmd/view.py
+++ b/lib/spack/spack/test/cmd/view.py
@@ -34,7 +34,7 @@ view = SpackCommand('view')
@pytest.mark.parametrize('cmd', ['hardlink', 'symlink', 'hard', 'add'])
def test_view_link_type(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery, cmd):
install('libdwarf')
viewpath = str(tmpdir.mkdir('view_{0}'.format(cmd)))
@@ -45,7 +45,7 @@ def test_view_link_type(
def test_view_external(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('externaltool')
viewpath = str(tmpdir.mkdir('view'))
@@ -54,7 +54,7 @@ def test_view_external(
def test_view_extension(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('extendee')
install('extension1@1.0')
@@ -80,7 +80,7 @@ def test_view_extension(
def test_view_extension_remove(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('extendee')
install('extension1@1.0')
@@ -99,7 +99,7 @@ def test_view_extension_remove(
def test_view_extension_conflict(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('extendee')
install('extension1@1.0')
@@ -111,7 +111,7 @@ def test_view_extension_conflict(
def test_view_extension_conflict_ignored(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('extendee')
install('extension1@1.0')
@@ -124,7 +124,7 @@ def test_view_extension_conflict_ignored(
def test_view_extension_global_activation(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('extendee')
install('extension1@1.0')
@@ -153,7 +153,7 @@ def test_view_extension_global_activation(
def test_view_extendee_with_global_activations(
- tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery):
install('extendee')
install('extension1@1.0')
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 989699bbf3..88ec9133c5 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -97,7 +97,7 @@ def spec(request):
return request.param
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestConcretize(object):
def test_concretize(self, spec):
check_concretize(spec)
@@ -255,7 +255,7 @@ class TestConcretize(object):
Spec('hypre').concretize()
def test_concretize_two_virtuals_with_one_bound(
- self, refresh_builtin_mock
+ self, mutable_mock_packages
):
"""Test a package with multiple virtual dependencies and one preset."""
Spec('hypre ^openblas').concretize()
diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py
index 7df20830df..2c0b36a6a8 100644
--- a/lib/spack/spack/test/concretize_preferences.py
+++ b/lib/spack/spack/test/concretize_preferences.py
@@ -61,7 +61,7 @@ def assert_variant_values(spec, **variants):
assert concrete.variants[variant].value == value
-@pytest.mark.usefixtures('concretize_scope', 'builtin_mock')
+@pytest.mark.usefixtures('concretize_scope', 'mock_packages')
class TestConcretizePreferences(object):
def test_preferred_variants(self):
"""Test preferred variants are applied correctly
@@ -77,7 +77,7 @@ class TestConcretizePreferences(object):
'mpileaks', debug=True, opt=True, shared=False, static=False
)
- def test_preferred_compilers(self, refresh_builtin_mock):
+ def test_preferred_compilers(self, mutable_mock_packages):
"""Test preferred compilers are applied correctly
"""
update_packages('mpileaks', 'compiler', ['clang@3.3'])
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 2e48d1d930..df88a1efaf 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -177,23 +177,21 @@ def repo_path():
@pytest.fixture(scope='module')
-def builtin_mock(repo_path):
- """Uses the 'builtin.mock' repository instead of 'builtin'"""
+def mock_packages(repo_path):
+ """Use the 'builtin.mock' repository instead of 'builtin'"""
mock_repo = copy.deepcopy(repo_path)
spack.repo.swap(mock_repo)
- BuiltinMock = collections.namedtuple('BuiltinMock', ['real', 'mock'])
- # Confusing, but we swapped above
- yield BuiltinMock(real=mock_repo, mock=spack.repo)
+ yield
spack.repo.swap(mock_repo)
-@pytest.fixture()
-def refresh_builtin_mock(builtin_mock, repo_path):
- """Refreshes the state of spack.repo"""
- # Get back the real repository
+@pytest.fixture(scope='function')
+def mutable_mock_packages(mock_packages, repo_path):
+ """Function-scoped mock packages, for tests that need to modify them."""
mock_repo = copy.deepcopy(repo_path)
spack.repo.swap(mock_repo)
- return builtin_mock
+ yield
+ spack.repo.swap(mock_repo)
@pytest.fixture(scope='session')
@@ -262,7 +260,7 @@ def config(configuration_dir):
@pytest.fixture(scope='module')
-def database(tmpdir_factory, builtin_mock, config):
+def database(tmpdir_factory, mock_packages, config):
"""Creates a mock database with some packages installed note that
the ref count for dyninst here will be 3, as it's recycled
across each install.
@@ -366,7 +364,7 @@ def refresh_db_on_exit(database):
@pytest.fixture()
-def install_mockery(tmpdir, config, builtin_mock):
+def install_mockery(tmpdir, config, mock_packages):
"""Hooks a fake install directory, DB, and stage directory into Spack."""
layout = spack.store.layout
extensions = spack.store.extensions
diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py
index 0adbf12aaa..e1dd72b61d 100644
--- a/lib/spack/spack/test/directory_layout.py
+++ b/lib/spack/spack/test/directory_layout.py
@@ -96,7 +96,7 @@ def test_yaml_directory_layout_parameters(
def test_read_and_write_spec(
- layout_and_dir, config, builtin_mock
+ layout_and_dir, config, mock_packages
):
"""This goes through each package in spack and creates a directory for
it. It then ensures that the spec for the directory's
@@ -174,7 +174,7 @@ def test_read_and_write_spec(
def test_handle_unknown_package(
- layout_and_dir, config, builtin_mock
+ layout_and_dir, config, mock_packages
):
"""This test ensures that spack can at least do *some*
operations with packages that are installed but that it
@@ -227,7 +227,7 @@ def test_handle_unknown_package(
spack.repo.swap(mock_db)
-def test_find(layout_and_dir, config, builtin_mock):
+def test_find(layout_and_dir, config, mock_packages):
"""Test that finding specs within an install layout works."""
layout, _ = layout_and_dir
packages = list(spack.repo.all_packages())[:max_packages]
diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py
index 2557c9ac8a..603f54d975 100644
--- a/lib/spack/spack/test/git_fetch.py
+++ b/lib/spack/spack/test/git_fetch.py
@@ -74,7 +74,7 @@ def test_fetch(type_of_test,
secure,
mock_git_repository,
config,
- refresh_builtin_mock,
+ mutable_mock_packages,
git_version):
"""Tries to:
diff --git a/lib/spack/spack/test/graph.py b/lib/spack/spack/test/graph.py
index b993d83214..1eeb9fd826 100644
--- a/lib/spack/spack/test/graph.py
+++ b/lib/spack/spack/test/graph.py
@@ -28,7 +28,7 @@ from spack.spec import Spec
from spack.graph import AsciiGraph, topological_sort, graph_dot
-def test_topo_sort(builtin_mock):
+def test_topo_sort(mock_packages):
"""Test topo sort gives correct order."""
s = Spec('mpileaks').normalized()
@@ -51,7 +51,7 @@ def test_topo_sort(builtin_mock):
assert topo.index('libdwarf') < topo.index('libelf')
-def test_static_graph_mpileaks(builtin_mock):
+def test_static_graph_mpileaks(mock_packages):
"""Test a static spack graph for a simple package."""
s = Spec('mpileaks').normalized()
@@ -75,7 +75,7 @@ def test_static_graph_mpileaks(builtin_mock):
assert ' "dyninst" -> "libelf"\n' in dot
-def test_dynamic_dot_graph_mpileaks(builtin_mock):
+def test_dynamic_dot_graph_mpileaks(mock_packages):
"""Test dynamically graphing the mpileaks package."""
s = Spec('mpileaks').normalized()
@@ -111,7 +111,7 @@ def test_dynamic_dot_graph_mpileaks(builtin_mock):
assert ' "%s" -> "%s"\n' % (dyninst_hash, libelf_hash) in dot
-def test_ascii_graph_mpileaks(builtin_mock):
+def test_ascii_graph_mpileaks(mock_packages):
"""Test dynamically graphing the mpileaks package."""
s = Spec('mpileaks').normalized()
diff --git a/lib/spack/spack/test/hg_fetch.py b/lib/spack/spack/test/hg_fetch.py
index 03cbd3d641..787ca00280 100644
--- a/lib/spack/spack/test/hg_fetch.py
+++ b/lib/spack/spack/test/hg_fetch.py
@@ -46,7 +46,7 @@ def test_fetch(
secure,
mock_hg_repository,
config,
- refresh_builtin_mock
+ mutable_mock_packages
):
"""Tries to:
diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py
index 7ce27b780b..5f1b59be2b 100644
--- a/lib/spack/spack/test/install.py
+++ b/lib/spack/spack/test/install.py
@@ -132,7 +132,7 @@ def test_dont_add_patches_to_installed_package(install_mockery, mock_fetch):
def test_installed_dependency_request_conflicts(
- install_mockery, mock_fetch, refresh_builtin_mock):
+ install_mockery, mock_fetch, mutable_mock_packages):
dependency = Spec('dependency-install')
dependency.concretize()
dependency.package.do_install()
diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py
index 43ac2da786..616d13c151 100644
--- a/lib/spack/spack/test/mirror.py
+++ b/lib/spack/spack/test/mirror.py
@@ -112,7 +112,7 @@ def check_mirror():
assert all(l in exclude for l in dcmp.left_only)
-@pytest.mark.usefixtures('config', 'refresh_builtin_mock')
+@pytest.mark.usefixtures('config', 'mutable_mock_packages')
class TestMirror(object):
def test_url_mirror(self, mock_archive):
set_up_package('trivial-install-test-package', mock_archive, 'url')
diff --git a/lib/spack/spack/test/modules/dotkit.py b/lib/spack/spack/test/modules/dotkit.py
index 71c253b479..2d4dbd863f 100644
--- a/lib/spack/spack/test/modules/dotkit.py
+++ b/lib/spack/spack/test/modules/dotkit.py
@@ -30,7 +30,7 @@ import spack.modules.dotkit
writer_cls = spack.modules.dotkit.DotkitModulefileWriter
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestDotkit(object):
def test_dotkit(self, modulefile_content, patch_configuration):
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py
index 9405c68062..7371a9a0d7 100644
--- a/lib/spack/spack/test/modules/lmod.py
+++ b/lib/spack/spack/test/modules/lmod.py
@@ -52,7 +52,7 @@ def provider(request):
return request.param
-@pytest.mark.usefixtures('config', 'builtin_mock',)
+@pytest.mark.usefixtures('config', 'mock_packages',)
class TestLmod(object):
def test_file_layout(
diff --git a/lib/spack/spack/test/modules/tcl.py b/lib/spack/spack/test/modules/tcl.py
index 8eb9c918dd..6c56dfaf3f 100644
--- a/lib/spack/spack/test/modules/tcl.py
+++ b/lib/spack/spack/test/modules/tcl.py
@@ -36,7 +36,7 @@ libdwarf_spec_string = 'libdwarf arch=x64-linux'
writer_cls = spack.modules.tcl.TclModulefileWriter
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestTcl(object):
def test_simple_case(self, modulefile_content, patch_configuration):
diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py
index 55da4b6279..7d90c12c85 100644
--- a/lib/spack/spack/test/multimethod.py
+++ b/lib/spack/spack/test/multimethod.py
@@ -28,13 +28,13 @@ import pytest
from spack.multimethod import NoSuchMethodError
-def test_no_version_match(builtin_mock):
+def test_no_version_match(mock_packages):
pkg = spack.repo.get('multimethod@2.0')
with pytest.raises(NoSuchMethodError):
pkg.no_version_2()
-def test_one_version_match(builtin_mock):
+def test_one_version_match(mock_packages):
pkg = spack.repo.get('multimethod@1.0')
assert pkg.no_version_2() == 1
@@ -45,7 +45,7 @@ def test_one_version_match(builtin_mock):
assert pkg.no_version_2() == 4
-def test_version_overlap(builtin_mock):
+def test_version_overlap(mock_packages):
pkg = spack.repo.get('multimethod@2.0')
assert pkg.version_overlap() == 1
@@ -53,7 +53,7 @@ def test_version_overlap(builtin_mock):
assert pkg.version_overlap() == 2
-def test_mpi_version(builtin_mock):
+def test_mpi_version(mock_packages):
pkg = spack.repo.get('multimethod^mpich@3.0.4')
assert pkg.mpi_version() == 3
@@ -64,7 +64,7 @@ def test_mpi_version(builtin_mock):
assert pkg.mpi_version() == 1
-def test_undefined_mpi_version(builtin_mock):
+def test_undefined_mpi_version(mock_packages):
pkg = spack.repo.get('multimethod^mpich@0.4')
assert pkg.mpi_version() == 1
@@ -72,7 +72,7 @@ def test_undefined_mpi_version(builtin_mock):
assert pkg.mpi_version() == 1
-def test_default_works(builtin_mock):
+def test_default_works(mock_packages):
pkg = spack.repo.get('multimethod%gcc')
assert pkg.has_a_default() == 'gcc'
@@ -83,7 +83,7 @@ def test_default_works(builtin_mock):
assert pkg.has_a_default() == 'default'
-def test_target_match(builtin_mock):
+def test_target_match(mock_packages):
platform = spack.architecture.platform()
targets = list(platform.targets.values())
for target in targets[:-1]:
@@ -98,7 +98,7 @@ def test_target_match(builtin_mock):
pkg.different_by_target()
-def test_dependency_match(builtin_mock):
+def test_dependency_match(mock_packages):
pkg = spack.repo.get('multimethod^zmpi')
assert pkg.different_by_dep() == 'zmpi'
@@ -111,7 +111,7 @@ def test_dependency_match(builtin_mock):
assert pkg.different_by_dep() == 'mpich'
-def test_virtual_dep_match(builtin_mock):
+def test_virtual_dep_match(mock_packages):
pkg = spack.repo.get('multimethod^mpich2')
assert pkg.different_by_virtual_dep() == 2
@@ -119,7 +119,7 @@ def test_virtual_dep_match(builtin_mock):
assert pkg.different_by_virtual_dep() == 1
-def test_multimethod_with_base_class(builtin_mock):
+def test_multimethod_with_base_class(mock_packages):
pkg = spack.repo.get('multimethod@3')
assert pkg.base_method() == "subclass_method"
diff --git a/lib/spack/spack/test/optional_deps.py b/lib/spack/spack/test/optional_deps.py
index 74314fe3cd..0c54fe8d77 100644
--- a/lib/spack/spack/test/optional_deps.py
+++ b/lib/spack/spack/test/optional_deps.py
@@ -107,14 +107,14 @@ def spec_and_expected(request):
return spec, Spec.from_literal(d)
-def test_normalize(spec_and_expected, config, builtin_mock):
+def test_normalize(spec_and_expected, config, mock_packages):
spec, expected = spec_and_expected
spec = Spec(spec)
spec.normalize()
assert spec.eq_dag(expected, deptypes=False)
-def test_default_variant(config, builtin_mock):
+def test_default_variant(config, mock_packages):
spec = Spec('optional-dep-test-3')
spec.concretize()
assert 'a' in spec
diff --git a/lib/spack/spack/test/package_hash.py b/lib/spack/spack/test/package_hash.py
index 77768bb648..9651805022 100644
--- a/lib/spack/spack/test/package_hash.py
+++ b/lib/spack/spack/test/package_hash.py
@@ -26,17 +26,17 @@ from spack.util.package_hash import package_hash, package_content
from spack.spec import Spec
-def test_hash(tmpdir, builtin_mock, config):
+def test_hash(tmpdir, mock_packages, config):
package_hash("hash-test1@1.2")
-def test_different_variants(tmpdir, builtin_mock, config):
+def test_different_variants(tmpdir, mock_packages, config):
spec1 = Spec("hash-test1@1.2 +variantx")
spec2 = Spec("hash-test1@1.2 +varianty")
assert package_hash(spec1) == package_hash(spec2)
-def test_all_same_but_name(tmpdir, builtin_mock, config):
+def test_all_same_but_name(tmpdir, mock_packages, config):
spec1 = Spec("hash-test1@1.2")
spec2 = Spec("hash-test2@1.2")
compare_sans_name(True, spec1, spec2)
@@ -46,7 +46,7 @@ def test_all_same_but_name(tmpdir, builtin_mock, config):
compare_sans_name(True, spec1, spec2)
-def test_all_same_but_archive_hash(tmpdir, builtin_mock, config):
+def test_all_same_but_archive_hash(tmpdir, mock_packages, config):
"""
Archive hash is not intended to be reflected in Package hash.
"""
@@ -55,19 +55,19 @@ def test_all_same_but_archive_hash(tmpdir, builtin_mock, config):
compare_sans_name(True, spec1, spec2)
-def test_all_same_but_patch_contents(tmpdir, builtin_mock, config):
+def test_all_same_but_patch_contents(tmpdir, mock_packages, config):
spec1 = Spec("hash-test1@1.1")
spec2 = Spec("hash-test2@1.1")
compare_sans_name(True, spec1, spec2)
-def test_all_same_but_patches_to_apply(tmpdir, builtin_mock, config):
+def test_all_same_but_patches_to_apply(tmpdir, mock_packages, config):
spec1 = Spec("hash-test1@1.4")
spec2 = Spec("hash-test2@1.4")
compare_sans_name(True, spec1, spec2)
-def test_all_same_but_install(tmpdir, builtin_mock, config):
+def test_all_same_but_install(tmpdir, mock_packages, config):
spec1 = Spec("hash-test1@1.5")
spec2 = Spec("hash-test2@1.5")
compare_sans_name(False, spec1, spec2)
diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py
index 2d99b20788..fde6e7d79d 100644
--- a/lib/spack/spack/test/packages.py
+++ b/lib/spack/spack/test/packages.py
@@ -34,7 +34,7 @@ from spack.spec import Spec
from spack.util.package_hash import package_content
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestPackage(object):
def test_load_package(self):
spack.repo.get('mpich')
diff --git a/lib/spack/spack/test/patch.py b/lib/spack/spack/test/patch.py
index e9c92235af..3e8bc62ba0 100644
--- a/lib/spack/spack/test/patch.py
+++ b/lib/spack/spack/test/patch.py
@@ -93,7 +93,7 @@ third line
assert filecmp.cmp('foo.txt', 'foo-expected.txt')
-def test_patch_in_spec(builtin_mock, config):
+def test_patch_in_spec(mock_packages, config):
"""Test whether patches in a package appear in the spec."""
spec = Spec('patch')
spec.concretize()
@@ -108,7 +108,7 @@ def test_patch_in_spec(builtin_mock, config):
spec.variants['patches'].value)
-def test_patched_dependency(builtin_mock, config):
+def test_patched_dependency(mock_packages, config):
"""Test whether patched dependencies work."""
spec = Spec('patch-a-dependency')
spec.concretize()
@@ -119,7 +119,7 @@ def test_patched_dependency(builtin_mock, config):
spec['libelf'].variants['patches'].value)
-def test_multiple_patched_dependencies(builtin_mock, config):
+def test_multiple_patched_dependencies(mock_packages, config):
"""Test whether multiple patched dependencies work."""
spec = Spec('patch-several-dependencies')
spec.concretize()
@@ -138,7 +138,7 @@ def test_multiple_patched_dependencies(builtin_mock, config):
spec['fake'].variants['patches'].value)
-def test_conditional_patched_dependencies(builtin_mock, config):
+def test_conditional_patched_dependencies(mock_packages, config):
"""Test whether conditional patched dependencies work."""
spec = Spec('patch-several-dependencies @1.0')
spec.concretize()
@@ -166,7 +166,7 @@ def test_conditional_patched_dependencies(builtin_mock, config):
spec['fake'].variants['patches'].value)
-def test_conditional_patched_deps_with_conditions(builtin_mock, config):
+def test_conditional_patched_deps_with_conditions(mock_packages, config):
"""Test whether conditional patched dependencies with conditions work."""
spec = Spec('patch-several-dependencies @1.0 ^libdwarf@20111030')
spec.concretize()
diff --git a/lib/spack/spack/test/provider_index.py b/lib/spack/spack/test/provider_index.py
index af1be26923..a890f80f1e 100644
--- a/lib/spack/spack/test/provider_index.py
+++ b/lib/spack/spack/test/provider_index.py
@@ -44,7 +44,7 @@ from spack.provider_index import ProviderIndex
from spack.spec import Spec
-def test_yaml_round_trip(builtin_mock):
+def test_yaml_round_trip(mock_packages):
p = ProviderIndex(spack.repo.all_package_names())
ostream = StringIO()
@@ -56,7 +56,7 @@ def test_yaml_round_trip(builtin_mock):
assert p == q
-def test_providers_for_simple(builtin_mock):
+def test_providers_for_simple(mock_packages):
p = ProviderIndex(spack.repo.all_package_names())
blas_providers = p.providers_for('blas')
@@ -69,7 +69,7 @@ def test_providers_for_simple(builtin_mock):
assert Spec('openblas-with-lapack') in lapack_providers
-def test_mpi_providers(builtin_mock):
+def test_mpi_providers(mock_packages):
p = ProviderIndex(spack.repo.all_package_names())
mpi_2_providers = p.providers_for('mpi@2')
@@ -82,13 +82,13 @@ def test_mpi_providers(builtin_mock):
assert Spec('zmpi') in mpi_3_providers
-def test_equal(builtin_mock):
+def test_equal(mock_packages):
p = ProviderIndex(spack.repo.all_package_names())
q = ProviderIndex(spack.repo.all_package_names())
assert p == q
-def test_copy(builtin_mock):
+def test_copy(mock_packages):
p = ProviderIndex(spack.repo.all_package_names())
q = p.copy()
assert p == q
diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py
index 671eb06979..5550a0fb88 100644
--- a/lib/spack/spack/test/spec_dag.py
+++ b/lib/spack/spack/test/spec_dag.py
@@ -108,7 +108,7 @@ w->y deptypes are (link, build), w->x and y->z deptypes are (test)
spack.repo = saved_repo
-@pytest.mark.usefixtures('refresh_builtin_mock')
+@pytest.mark.usefixtures('mutable_mock_packages')
class TestSpecDag(object):
def test_conflicting_package_constraints(self, set_dependency):
diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py
index 396ef41d4a..199f94e50d 100644
--- a/lib/spack/spack/test/spec_semantics.py
+++ b/lib/spack/spack/test/spec_semantics.py
@@ -101,7 +101,7 @@ def check_invalid_constraint(spec, constraint):
spec.constrain(constraint)
-@pytest.mark.usefixtures('config', 'builtin_mock')
+@pytest.mark.usefixtures('config', 'mock_packages')
class TestSpecSematics(object):
"""This tests satisfies(), constrain() and other semantic operations
on specs.
diff --git a/lib/spack/spack/test/spec_yaml.py b/lib/spack/spack/test/spec_yaml.py
index b9798190b5..fe118fea49 100644
--- a/lib/spack/spack/test/spec_yaml.py
+++ b/lib/spack/spack/test/spec_yaml.py
@@ -46,13 +46,13 @@ def test_simple_spec():
check_yaml_round_trip(spec)
-def test_normal_spec(builtin_mock):
+def test_normal_spec(mock_packages):
spec = Spec('mpileaks+debug~opt')
spec.normalize()
check_yaml_round_trip(spec)
-def test_external_spec(config, builtin_mock):
+def test_external_spec(config, mock_packages):
spec = Spec('externaltool')
spec.concretize()
check_yaml_round_trip(spec)
@@ -62,13 +62,13 @@ def test_external_spec(config, builtin_mock):
check_yaml_round_trip(spec)
-def test_ambiguous_version_spec(builtin_mock):
+def test_ambiguous_version_spec(mock_packages):
spec = Spec('mpileaks@1.0:5.0,6.1,7.3+debug~opt')
spec.normalize()
check_yaml_round_trip(spec)
-def test_concrete_spec(config, builtin_mock):
+def test_concrete_spec(config, mock_packages):
spec = Spec('mpileaks+debug~opt')
spec.concretize()
check_yaml_round_trip(spec)
@@ -80,7 +80,7 @@ def test_yaml_multivalue():
check_yaml_round_trip(spec)
-def test_yaml_subdag(config, builtin_mock):
+def test_yaml_subdag(config, mock_packages):
spec = Spec('mpileaks^mpich+debug')
spec.concretize()
yaml_spec = Spec.from_yaml(spec.to_yaml())
@@ -89,7 +89,7 @@ def test_yaml_subdag(config, builtin_mock):
assert spec[dep].eq_dag(yaml_spec[dep])
-def test_using_ordered_dict(builtin_mock):
+def test_using_ordered_dict(mock_packages):
""" Checks that dicts are ordered
Necessary to make sure that dag_hash is stable across python
@@ -122,7 +122,7 @@ def test_using_ordered_dict(builtin_mock):
def test_ordered_read_not_required_for_consistent_dag_hash(
- config, builtin_mock
+ config, mock_packages
):
"""Make sure ordered serialization isn't required to preserve hashes.
diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py
index 6edd47e5bf..01b4fa9e90 100644
--- a/lib/spack/spack/test/stage.py
+++ b/lib/spack/spack/test/stage.py
@@ -199,7 +199,7 @@ def search_fn():
return _Mock()
-@pytest.mark.usefixtures('builtin_mock')
+@pytest.mark.usefixtures('mock_packages')
class TestStage(object):
stage_name = 'spack-test-stage'
diff --git a/lib/spack/spack/test/svn_fetch.py b/lib/spack/spack/test/svn_fetch.py
index 85159615e0..1b3040489a 100644
--- a/lib/spack/spack/test/svn_fetch.py
+++ b/lib/spack/spack/test/svn_fetch.py
@@ -46,7 +46,7 @@ def test_fetch(
secure,
mock_svn_repository,
config,
- refresh_builtin_mock
+ mutable_mock_packages
):
"""Tries to:
diff --git a/lib/spack/spack/test/url_fetch.py b/lib/spack/spack/test/url_fetch.py
index 28fb07760a..5a9f996e3a 100644
--- a/lib/spack/spack/test/url_fetch.py
+++ b/lib/spack/spack/test/url_fetch.py
@@ -46,7 +46,7 @@ def test_fetch(
secure,
checksum_type,
config,
- refresh_builtin_mock
+ mutable_mock_packages
):
"""Fetch an archive and make sure we can checksum it."""
mock_archive.url
@@ -81,7 +81,7 @@ def test_fetch(
assert 'echo Building...' in contents
-def test_from_list_url(builtin_mock, config):
+def test_from_list_url(mock_packages, config):
pkg = spack.repo.get('url-list-test')
for ver_str in ['0.0.0', '1.0.0', '2.0.0',
'3.0', '4.5', '2.0.0b2',