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`
This commit is contained in:
Todd Gamblin 2018-04-28 22:48:26 -07:00 committed by scheibelp
parent d1903f3bf3
commit 2a09b627c9
33 changed files with 117 additions and 121 deletions

View file

@ -30,7 +30,7 @@
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):

View file

@ -38,7 +38,7 @@
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')

View file

@ -50,7 +50,7 @@ def __call__(self, *args, **kwargs):
@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]),

View file

@ -37,14 +37,14 @@
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')

View file

@ -34,14 +34,14 @@
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')

View file

@ -31,35 +31,35 @@
@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')

View file

@ -59,7 +59,7 @@ def noop(*args, **kwargs):
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 check(pkg):
@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 check(pkg):
@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 check(pkg):
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()

View file

@ -63,7 +63,7 @@ def mock_compiler_dir(tmpdir):
return str(tmpdir)
@pytest.mark.usefixtures('config', 'builtin_mock')
@pytest.mark.usefixtures('config', 'mock_packages')
class TestCompilerCommand(object):
def test_compiler_remove(self):

View file

@ -34,7 +34,7 @@
@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')

View file

@ -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 @@ def test_concretize_two_virtuals(self):
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()

View file

@ -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 @@ def test_preferred_variants(self):
'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'])

View file

@ -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

View file

@ -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]

View file

@ -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:

View file

@ -28,7 +28,7 @@
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()

View file

@ -46,7 +46,7 @@ def test_fetch(
secure,
mock_hg_repository,
config,
refresh_builtin_mock
mutable_mock_packages
):
"""Tries to:

View file

@ -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()

View file

@ -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')

View file

@ -30,7 +30,7 @@
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):

View file

@ -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(

View file

@ -36,7 +36,7 @@
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):

View file

@ -28,13 +28,13 @@
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"

View file

@ -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

View file

@ -26,17 +26,17 @@
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)

View file

@ -34,7 +34,7 @@
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')

View file

@ -93,7 +93,7 @@ def test_url_patch(mock_stage, filename, sha256, archive_sha256):
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()

View file

@ -44,7 +44,7 @@
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

View file

@ -108,7 +108,7 @@ def test_test_deptype():
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):

View file

@ -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.

View file

@ -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 descend_and_check(iterable, level=0):
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.

View file

@ -199,7 +199,7 @@ def __call__(self):
return _Mock()
@pytest.mark.usefixtures('builtin_mock')
@pytest.mark.usefixtures('mock_packages')
class TestStage(object):
stage_name = 'spack-test-stage'

View file

@ -46,7 +46,7 @@ def test_fetch(
secure,
mock_svn_repository,
config,
refresh_builtin_mock
mutable_mock_packages
):
"""Tries to:

View file

@ -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',