spack.test package

Submodules

spack.test.architecture module

Test checks if the architecture class is created correctly and also that the functions are looking for the correct architecture name

spack.test.architecture.test_boolness()
spack.test.architecture.test_dict_functions_for_architecture()
spack.test.architecture.test_platform()
spack.test.architecture.test_user_back_end_input(config)

Test when user inputs backend that both the backend target and backend operating system match

spack.test.architecture.test_user_defaults(config)
spack.test.architecture.test_user_front_end_input(config)

Test when user inputs just frontend that both the frontend target and frontend operating system match

spack.test.architecture.test_user_input_combination(config)

spack.test.build_system_guess module

spack.test.build_system_guess.test_build_systems(url_and_build_system)
spack.test.build_system_guess.url_and_build_system(request, tmpdir)

Sets up the resources to be pulled by the stage with the appropriate file name and returns their url along with the correct build-system guess

spack.test.build_systems module

spack.test.build_systems.test_cmake_std_args(config, builtin_mock)

spack.test.cc module

This test checks that the Spack cc compiler wrapper is parsing arguments correctly.

class spack.test.cc.CompilerWrapperTest(methodName='runTest')

Bases: unittest.case.TestCase

check_cc(command, args, expected)
check_cpp(command, args, expected)
check_cxx(command, args, expected)
check_fc(command, args, expected)
check_ld(command, args, expected)
setUp()
tearDown()
test_all_deps()

Ensure includes and RPATHs for all deps are added.

test_as_mode()
test_ccld_mode()
test_cpp_mode()
test_dep_include()

Ensure a single dependency include directory is added.

test_dep_lib()

Ensure a single dependency RPATH is added.

test_dep_lib_no_lib()

Ensure a single dependency RPATH is added with no -L.

test_dep_lib_no_rpath()

Ensure a single dependency link flag is added with no dep RPATH.

test_dep_rpath()

Ensure RPATHs for root package are added.

test_flags()
test_ld_deps()

Ensure no (extra) -I args or -Wl, are passed in ld mode.

Ensure SPACK_LINK_DEPS controls -L for ld.

test_ld_deps_no_rpath()

Ensure SPACK_RPATH_DEPS controls RPATHs for ld.

test_ld_deps_reentrant()

Make sure ld -r is handled correctly on OS’s where it doesn’t support rpaths.

test_ld_mode()
test_vcheck_mode()

spack.test.concretize module

class spack.test.concretize.TestConcretize

Bases: object

concretize_multi_provider()
pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'builtin_mock'), 'kwargs': {}}>]
test_compiler_child()
test_compiler_inheritance()
test_concretize(spec)
test_concretize_mention_build_dep()
test_concretize_preferred_version()
test_concretize_two_virtuals()

Test a package with multiple virtual dependencies.

test_concretize_two_virtuals_with_dual_provider()

Test a package with multiple virtual dependencies and force a provider that provides both.

test_concretize_two_virtuals_with_dual_provider_and_a_conflict()

Test a package with multiple virtual dependencies and force a provider that provides both, and another conflicting package that provides one.

test_concretize_two_virtuals_with_one_bound(refresh_builtin_mock)

Test a package with multiple virtual dependencies and one preset.

test_concretize_two_virtuals_with_two_bound()

Test a package with multiple virtual deps and two of them preset.

test_concretize_with_provides_when()

Make sure insufficient versions of MPI are not in providers list when we ask for some advanced version.

test_concretize_with_restricted_virtual()
test_different_compilers_get_different_flags()
test_external_and_virtual()
test_external_package()
test_external_package_module()
test_find_spec_children()
test_find_spec_none()
test_find_spec_parents()

Tests the spec finding logic used by concretization.

test_find_spec_self()
test_find_spec_sibling()
test_my_dep_depends_on_provider_of_my_virtual_dep()
test_no_compilers_for_arch()
test_no_matching_compiler_specs()
test_nobuild_package()
test_provides_handles_multiple_providers_of_same_vesrion()
test_virtual_is_fully_expanded_for_callpath()
test_virtual_is_fully_expanded_for_mpileaks()
spack.test.concretize.check_concretize(abstract_spec)
spack.test.concretize.check_spec(abstract, concrete)
spack.test.concretize.spec(request)

Spec to be concretized

spack.test.concretize_preferences module

class spack.test.concretize_preferences.TestConcretizePreferences

Bases: object

pytestmark = [<MarkDecorator 'usefixtures' {'args': ('concretize_scope', 'builtin_mock'), 'kwargs': {}}>]
test_all_is_not_a_virtual()

Verify that all is allowed in packages.yaml.

test_develop()

Test concretization with develop version

test_external_mpi()
test_no_virtuals_in_packages_yaml()

Verify that virtuals are not allowed in packages.yaml.

test_preferred_compilers(refresh_builtin_mock)

Test preferred compilers are applied correctly

test_preferred_providers()

Test preferred providers of virtual packages are applied correctly

test_preferred_variants()

Test preferred variants are applied correctly

test_preferred_versions()

Test preferred package versions are applied correctly

spack.test.concretize_preferences.assert_variant_values(spec, **variants)
spack.test.concretize_preferences.concretize(abstract_spec)
spack.test.concretize_preferences.concretize_scope(config, tmpdir)

Adds a scope for concretization preferences

spack.test.concretize_preferences.update_packages(pkgname, section, value)

Update config and reread package list

spack.test.config module

class spack.test.config.TestConfig

Bases: object

check_canonical(var, expected)

Ensure that <expected> is substituted properly for <var> in strings containing <var> in various positions.

pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config',), 'kwargs': {}}>]
test_read_config(write_config_file)
test_read_config_merge_list(write_config_file)
test_read_config_override_all(write_config_file)
test_read_config_override_key(write_config_file)
test_read_config_override_list(write_config_file)
test_substitute_config_variables()
test_substitute_tempdir()
test_substitute_user()
test_write_key_in_memory(compiler_specs)
test_write_key_to_disk(compiler_specs)
test_write_list_in_memory()
test_write_to_same_priority_file(compiler_specs)
spack.test.config.check_compiler_config(comps, *compiler_names)

Check that named compilers in comps match Spack’s config.

spack.test.config.compiler_specs()

Returns a couple of compiler specs needed for the tests

spack.test.config.config(tmpdir)

Mocks the configuration scope.

spack.test.config.write_config_file(tmpdir)

Returns a function that writes a config file.

spack.test.conftest module

spack.test.conftest.builtin_mock(repo_path)

Uses the ‘builtin.mock’ repository instead of ‘builtin’

spack.test.conftest.config(configuration_dir)

Hooks the mock configuration files into spack.config

spack.test.conftest.configuration_dir(tmpdir_factory, linux_os)

Copies mock configuration files in a temporary directory. Returns the directory path.

spack.test.conftest.database(tmpdir_factory, builtin_mock, 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.

spack.test.conftest.linux_os()

Returns a named tuple with attributes ‘name’ and ‘version’ representing the OS.

spack.test.conftest.mock_archive()

Creates a very simple archive directory with a configure script and a makefile that installs to a prefix. Tars it up into an archive.

spack.test.conftest.mock_fetch_cache(monkeypatch)

Substitutes spack.fetch_cache with a mock object that does nothing and raises on fetch.

spack.test.conftest.mock_git_repository()

Creates a very simple git repository with two branches and two commits.

spack.test.conftest.mock_hg_repository()

Creates a very simple hg repository with two commits.

spack.test.conftest.mock_svn_repository()

Creates a very simple svn repository with two commits.

spack.test.conftest.no_stdin_duplication(monkeypatch)

Duplicating stdin (or any other stream) returns an empty cStringIO object.

spack.test.conftest.refresh_builtin_mock(builtin_mock, repo_path)

Refreshes the state of spack.repo

spack.test.conftest.refresh_db_on_exit(database)

“Restores the state of the database after a test.

spack.test.conftest.repo_path()

Session scoped RepoPath object pointing to the mock repository

spack.test.database module

These tests check the database is functioning properly, both in memory and in its file

spack.test.database.test_005_db_exists(database)

Make sure db cache file exists after creating.

spack.test.database.test_010_all_install_sanity(database)

Ensure that the install layout reflects what we think it does.

spack.test.database.test_015_write_and_read(database)
spack.test.database.test_020_db_sanity(database)

Make sure query() returns what’s actually in the db.

spack.test.database.test_025_reindex(database)

Make sure reindex works and ref counts are valid.

spack.test.database.test_030_db_sanity_from_another_process(database, refresh_db_on_exit)
spack.test.database.test_040_ref_counts(database)

Ensure that we got ref counts right when we read the DB.

spack.test.database.test_050_basic_query(database)

Ensure querying database is consistent with what is installed.

spack.test.database.test_060_remove_and_add_root_package(database)
spack.test.database.test_070_remove_and_add_dependency_package(database)
spack.test.database.test_080_root_ref_counts(database)
spack.test.database.test_090_non_root_ref_counts(database)
spack.test.database.test_100_no_write_with_exception_on_remove(database)
spack.test.database.test_110_no_write_with_exception_on_install(database)
spack.test.database.test_default_queries(database)

spack.test.directory_layout module

This test verifies that the Spack directory layout works properly.

spack.test.directory_layout.layout_and_dir(tmpdir)

Returns a directory layout and the corresponding directory.

spack.test.directory_layout.test_find(layout_and_dir, config, builtin_mock)

Test that finding specs within an install layout works.

spack.test.directory_layout.test_handle_unknown_package(layout_and_dir, config, builtin_mock)

This test ensures that spack can at least do some operations with packages that are installed but that it does not know about. This is actually not such an uncommon scenario with spack; it can happen when you switch from a git branch where you’re working on a new package.

This test ensures that the directory layout stores enough information about installed packages’ specs to uninstall or query them again if the package goes away.

spack.test.directory_layout.test_read_and_write_spec(layout_and_dir, config, builtin_mock)

This goes through each package in spack and creates a directory for it. It then ensures that the spec for the directory’s installed package can be read back in consistently, and finally that the directory can be removed by the directory layout.

spack.test.environment module

spack.test.environment.bin_paths()

Returns a list of bin paths, including system ones.

spack.test.environment.env(prepare_environment_for_tests)

Returns an empty EnvironmentModifications object.

spack.test.environment.files_to_be_sourced()

Returns a list of files to be sourced

spack.test.environment.miscellaneous_paths()

Returns a list of paths, including system ones.

spack.test.environment.prepare_environment_for_tests()

Sets a few dummy variables in the current environment, that will be useful for the tests below.

spack.test.environment.test_extend(env)

Tests that we can construct a list of environment modifications starting from another list.

spack.test.environment.test_extra_arguments(env)

Tests that we can attach extra arguments to any command.

spack.test.environment.test_filter_system_bin_paths(bin_paths)

Tests that the filtering of system bin paths works as expected.

spack.test.environment.test_filter_system_paths(miscellaneous_paths)

Tests that the filtering of system paths works as expected.

spack.test.environment.test_path_manipulation(env)

Tests manipulating list of paths in the environment.

spack.test.environment.test_set(env)

Tests setting values in the environment.

spack.test.environment.test_set_path(env)

Tests setting paths in an environment variable.

spack.test.environment.test_source_files(files_to_be_sourced)

Tests the construction of a list of environment modifications that are the result of sourcing a file.

spack.test.environment.test_unset(env)

Tests unsetting values in the environment.

spack.test.file_cache module

Test Spack’s FileCache.

spack.test.file_cache.file_cache(tmpdir)

Returns a properly initialized FileCache instance

spack.test.file_cache.test_write_and_read_cache_file(file_cache)

Test writing then reading a cached file.

spack.test.file_cache.test_write_and_remove_cache_file(file_cache)

Test two write transactions on a cached file. Then try to remove an entry from it.

spack.test.git_fetch module

spack.test.git_fetch.test_fetch(type_of_test, mock_git_repository, config, refresh_builtin_mock)

Tries to:

  1. Fetch the repo using a fetch strategy constructed with supplied args (they depend on type_of_test).
  2. Check if the test_file is in the checked out repository.
  3. Assert that the repository is at the revision supplied.
  4. Add and remove some files, then reset the repo, and ensure it’s all there again.
spack.test.git_fetch.type_of_test(request)

Returns one of the test type available for the mock_git_repository

spack.test.graph module

spack.test.graph.test_ascii_graph_mpileaks(builtin_mock)

Test dynamically graphing the mpileaks package.

spack.test.graph.test_dynamic_dot_graph_mpileaks(builtin_mock)

Test dynamically graphing the mpileaks package.

spack.test.graph.test_static_graph_mpileaks(builtin_mock)

Test a static spack graph for a simple package.

spack.test.graph.test_topo_sort(builtin_mock)

Test topo sort gives correct order.

spack.test.hg_fetch module

spack.test.hg_fetch.test_fetch(type_of_test, mock_hg_repository, config, refresh_builtin_mock)

Tries to:

  1. Fetch the repo using a fetch strategy constructed with supplied args (they depend on type_of_test).
  2. Check if the test_file is in the checked out repository.
  3. Assert that the repository is at the revision supplied.
  4. Add and remove some files, then reset the repo, and ensure it’s all there again.
spack.test.hg_fetch.type_of_test(request)

Returns one of the test type available for the mock_hg_repository

spack.test.install module

spack.test.install.fake_fetchify(url, pkg)

Fake the URL for a package so it downloads from a file.

spack.test.install.install_mockery(tmpdir, config, builtin_mock)

Hooks a fake install directory and a fake db into Spack.

spack.test.install.test_failing_build(mock_archive)
spack.test.install.test_install_and_uninstall(mock_archive)
spack.test.install.test_store(mock_archive)

spack.test.library_list module

class spack.test.library_list.LibraryListTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_add()
test_flags()
test_get_item()
test_joined_and_str()
test_paths_manipulation()
test_repr()

spack.test.lock module

These tests ensure that our lock works correctly.

class spack.test.lock.LockTest(methodName='runTest')

Bases: unittest.case.TestCase

acquire_read(start=0, length=0)
acquire_write(start=0, length=0)
multiproc_test(*functions)

Order some processes using simple barrier synchronization.

setUp()
tearDown()
test_complex_acquire_and_release_chain()
test_read_lock_timeout_on_write()
test_read_lock_timeout_on_write_2()
test_read_lock_timeout_on_write_3()
test_read_lock_timeout_on_write_ranges()

small write lock, read whole file.

test_read_lock_timeout_on_write_ranges_2()

small write lock, small read lock

test_read_lock_timeout_on_write_ranges_3()

two write locks, overlapping read locks

test_transaction()
test_transaction_with_context_manager()
test_transaction_with_context_manager_and_exception()
test_transaction_with_exception()
test_upgrade_read_to_write()
test_upgrade_read_to_write_fails_with_readonly_file()
test_write_lock_timeout_on_read()
test_write_lock_timeout_on_read_2()
test_write_lock_timeout_on_read_3()
test_write_lock_timeout_on_read_ranges()
test_write_lock_timeout_on_read_ranges_2()
test_write_lock_timeout_on_read_ranges_3()
test_write_lock_timeout_on_read_ranges_4()
test_write_lock_timeout_on_read_ranges_5()
test_write_lock_timeout_on_write()
test_write_lock_timeout_on_write_2()
test_write_lock_timeout_on_write_3()
test_write_lock_timeout_on_write_ranges()
test_write_lock_timeout_on_write_ranges_2()
test_write_lock_timeout_on_write_ranges_3()
test_write_lock_timeout_on_write_ranges_4()
test_write_lock_timeout_with_multiple_readers_2_1()
test_write_lock_timeout_with_multiple_readers_2_1_ranges()
test_write_lock_timeout_with_multiple_readers_2_2()
test_write_lock_timeout_with_multiple_readers_2_3_ranges()
test_write_lock_timeout_with_multiple_readers_3_1()
test_write_lock_timeout_with_multiple_readers_3_1_ranges()
test_write_lock_timeout_with_multiple_readers_3_2()
test_write_lock_timeout_with_multiple_readers_3_2_ranges()
timeout_read(start=0, length=0)
timeout_write(start=0, length=0)

spack.test.make_executable module

Tests for Spack’s built-in parallel make support.

This just tests whether the right args are getting passed to make.

class spack.test.make_executable.MakeExecutableTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
tearDown()
test_make_explicit()
test_make_normal()
test_make_one_job()
test_make_parallel_disabled()
test_make_parallel_false()
test_make_parallel_precedence()

spack.test.mirror module

class spack.test.mirror.TestMirror

Bases: object

pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'refresh_builtin_mock'), 'kwargs': {}}>]
test_all_mirror(mock_git_repository, mock_svn_repository, mock_hg_repository, mock_archive)
test_git_mirror(mock_git_repository)
test_hg_mirror(mock_hg_repository)
test_svn_mirror(mock_svn_repository)
test_url_mirror(mock_archive)
spack.test.mirror.check_mirror()
spack.test.mirror.set_up_package(name, repository, url_attr)

Set up a mock package to be mirrored. Each package needs us to:

  1. Set up a mock repo/archive to fetch from.
  2. Point the package’s version args at that repo.

spack.test.modules module

class spack.test.modules.TestDotkit

Bases: object

configuration_dotkit = {'enable': ['dotkit'], 'dotkit': {'all': {'prerequisites': 'direct'}}}
pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'builtin_mock', 'stringio_open'), 'kwargs': {}}>]
test_dotkit(dotkit_factory)
class spack.test.modules.TestLmod

Bases: object

configuration_alter_environment = {'enable': ['lmod'], 'lmod': {'all': {'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']}}, 'platform=test target=x86_32': {'load': ['foo/bar']}, 'platform=test target=x86_64': {'environment': {'set': {'FOO': 'foo'}, 'unset': ['BAR']}}}}
configuration_autoload_all = {'enable': ['lmod'], 'lmod': {'all': {'autoload': 'all'}}}
configuration_autoload_direct = {'enable': ['lmod'], 'lmod': {'all': {'autoload': 'direct'}}}
configuration_blacklist = {'enable': ['lmod'], 'lmod': {'blacklist': ['callpath'], 'all': {'autoload': 'direct'}}}
configuration_no_hash = {'enable': ['lmod'], 'lmod': {'hash_length': 0}}
pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'builtin_mock', 'stringio_open'), 'kwargs': {}}>]
test_alter_environment(lmod_factory)
test_autoload(lmod_factory)
test_blacklist(lmod_factory)
test_no_hash(lmod_factory)
test_simple_case(lmod_factory)
class spack.test.modules.TestTcl

Bases: object

configuration_alter_environment = {'tcl': {'all': {'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']}, 'environment': {'set': {'${PACKAGE}_ROOT': '${PREFIX}'}}}, 'platform=test target=x86_32': {'load': ['foo/bar']}, 'platform=test target=x86_64': {'environment': {'set': {'FOO': 'foo'}, 'unset': ['BAR']}}}, 'enable': ['tcl']}
configuration_autoload_all = {'tcl': {'all': {'autoload': 'all'}}, 'enable': ['tcl']}
configuration_autoload_direct = {'tcl': {'all': {'autoload': 'direct'}}, 'enable': ['tcl']}
configuration_blacklist = {'tcl': {'blacklist': ['callpath', 'mpi'], 'whitelist': ['zmpi'], 'all': {'autoload': 'direct'}}, 'enable': ['tcl']}
configuration_conflicts = {'tcl': {'all': {'conflict': ['${PACKAGE}', 'intel/14.0.1']}, 'naming_scheme': '${PACKAGE}/${VERSION}-${COMPILERNAME}'}, 'enable': ['tcl']}
configuration_prerequisites_all = {'tcl': {'all': {'prerequisites': 'all'}}, 'enable': ['tcl']}
configuration_prerequisites_direct = {'tcl': {'all': {'prerequisites': 'direct'}}, 'enable': ['tcl']}
configuration_suffix = {'tcl': {'mpileaks': {'suffixes': {'~debug': 'bar', '+debug': 'foo'}}}, 'enable': ['tcl']}
configuration_wrong_conflicts = {'tcl': {'all': {'conflict': ['${PACKAGE}/${COMPILERNAME}']}, 'naming_scheme': '${PACKAGE}/${VERSION}-${COMPILERNAME}'}, 'enable': ['tcl']}
pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'builtin_mock', 'stringio_open'), 'kwargs': {}}>]
test_alter_environment(tcl_factory)
test_autoload(tcl_factory)
test_blacklist(tcl_factory)
test_conflicts(tcl_factory)
test_prerequisites(tcl_factory)
test_setup_environment(tcl_factory)
test_simple_case(tcl_factory)
test_suffixes(tcl_factory)
spack.test.modules.dotkit_factory(tmpdir, monkeypatch)

Returns a factory that writes DotKit module files.

spack.test.modules.get_modulefile_content(factory, spec)

Writes the module file and returns the content as a string.

Parameters:
  • factory – module file factory
  • spec – spec of the module file to be written
Returns:

content of the module file

Return type:

str

spack.test.modules.lmod_factory(tmpdir, monkeypatch)

Returns a factory that writes hierarchical LUA module files.

spack.test.modules.stringio_open(monkeypatch)

Overrides the open builtin in spack.modules with an implementation that writes on a StringIO instance.

spack.test.modules.tcl_factory(tmpdir, monkeypatch)

Returns a factory that writes non-hierarchical TCL module files.

spack.test.modules.test_inspect_path()
spack.test.modules.test_update_dictionary_extending_list()

spack.test.multimethod module

Test for multi_method dispatch.

spack.test.multimethod.test_default_works(builtin_mock)
spack.test.multimethod.test_dependency_match(builtin_mock)
spack.test.multimethod.test_mpi_version(builtin_mock)
spack.test.multimethod.test_multimethod_with_base_class(builtin_mock)
spack.test.multimethod.test_no_version_match(builtin_mock)
spack.test.multimethod.test_one_version_match(builtin_mock)
spack.test.multimethod.test_target_match(builtin_mock)
spack.test.multimethod.test_undefined_mpi_version(builtin_mock)
spack.test.multimethod.test_version_overlap(builtin_mock)
spack.test.multimethod.test_virtual_dep_match(builtin_mock)

spack.test.namespace_trie module

class spack.test.namespace_trie.NamespaceTrieTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_add_multiple()
test_add_none_multiple()
test_add_none_single()
test_add_single()
test_add_three()

spack.test.optional_deps module

spack.test.optional_deps.spec_and_expected(request)

Parameters for te normalization test.

spack.test.optional_deps.test_default_variant(config, builtin_mock)
spack.test.optional_deps.test_normalize(spec_and_expected, config, builtin_mock)

spack.test.package_sanity module

This test does sanity checks on Spack’s builtin package database.

class spack.test.package_sanity.PackageSanityTest(methodName='runTest')

Bases: unittest.case.TestCase

check_db()

Get all packages in a DB to make sure they work.

test_all_versions_are_lowercase()

Spack package names must be lowercase, and use - instead of _.

test_get_all_mock_packages()

Get the mock packages once each too.

test_get_all_packages()

Get all packages once and make sure that works.

test_url_versions()

Check URLs for regular packages, if they are explicitly defined.

spack.test.packages module

class spack.test.packages.TestPackage

Bases: object

pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'builtin_mock'), 'kwargs': {}}>]
test_dependency_extensions()
test_import_class_from_package()
test_import_module_from_package()
test_import_namespace_container_modules()
test_import_package()
test_import_package_as()
test_inheritance_of_diretives()
test_load_package()
test_nonexisting_package_filename()
test_package_class_names()
test_package_filename()
test_package_name()

spack.test.pattern module

class spack.test.pattern.CompositeTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_composite_from_interface()
test_composite_from_method_list()
test_error_conditions()

spack.test.provider_index module

Tests for provider index cache files.

Tests assume that mock packages provide this:

{'blas':   {
     blas: set([netlib-blas, openblas, openblas-with-lapack])},
 'lapack': {lapack: set([netlib-lapack, openblas-with-lapack])},
 'mpi': {mpi@:1: set([mpich@:1]),
                  mpi@:2.0: set([mpich2]),
                  mpi@:2.1: set([mpich2@1.1:]),
                  mpi@:2.2: set([mpich2@1.2:]),
                  mpi@:3: set([mpich@3:]),
                  mpi@:10.0: set([zmpi])},
  'stuff': {stuff: set([externalvirtual])}}
spack.test.provider_index.test_copy(builtin_mock)
spack.test.provider_index.test_equal(builtin_mock)
spack.test.provider_index.test_mpi_providers(builtin_mock)
spack.test.provider_index.test_providers_for_simple(builtin_mock)
spack.test.provider_index.test_yaml_round_trip(builtin_mock)

spack.test.python_version module

This test ensures that all Spack files are Python version 2.6 or less.

Spack was originally 2.7, but enough systems in 2014 are still using 2.6 on their frontend nodes that we need 2.6 to get adopted.

class spack.test.python_version.PythonVersionTest(methodName='runTest')

Bases: unittest.case.TestCase

check_python_versions(*files)
package_py_files()
pyfiles(*search_paths)
test_core_module_compatibility()
test_package_module_compatibility()

spack.test.sbang module

Test that Spack’s shebang filtering works correctly.

class spack.test.sbang.SbangTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
tearDown()
test_shebang_handles_non_writable_files()
test_shebang_handling()

spack.test.spack_yaml module

Test Spack’s custom YAML format.

class spack.test.spack_yaml.SpackYamlTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_dict_order()
test_line_numbers()
test_parse()
test_yaml_aliases()

spack.test.spec_dag module

These tests check Spec DAG operations using dummy packages.

class spack.test.spec_dag.TestSpecDag

Bases: object

check_diamond_deptypes(spec)

Validate deptypes in dt-diamond spec.

check_diamond_normalized_dag(spec)
pytestmark = [<MarkDecorator 'usefixtures' {'args': ('refresh_builtin_mock',), 'kwargs': {}}>]
test_concretize_deptypes()

Ensure that dependency types are preserved after concretization.

test_conflicting_package_constraints(set_dependency)
test_conflicting_spec_constraints()
test_construct_spec_with_deptypes()
test_contains()
test_copy_concretized()
test_copy_dependencies()
test_copy_deptypes()

Ensure that dependency types are preserved by spec copy.

test_copy_normalized()
test_copy_simple()
test_dependents_and_dependencies_are_correct()
test_deptype_traversal()
test_deptype_traversal_full()
test_deptype_traversal_run()
test_deptype_traversal_with_builddeps()
test_edge_traversals()

Make sure child and parent traversals of specs work.

test_equal()
test_getitem_exceptional_paths()
test_getitem_query()
test_hash_bits()

Ensure getting first n bits of a base32-encoded DAG hash works.

test_invalid_dep()
test_normalize_a_lot()
test_normalize_diamond_deptypes()

Ensure that dependency types are preserved even if the same thing is depended on in two different ways.

test_normalize_mpileaks()
test_normalize_twice()

Make sure normalize can be run twice on the same spec, and that it is idempotent.

test_normalize_with_virtual_package()
test_normalize_with_virtual_spec()
test_postorder_edge_traversal()
test_postorder_node_traversal()
test_postorder_path_traversal()
test_preorder_edge_traversal()
test_preorder_node_traversal()
test_preorder_path_traversal()
test_traversal_directions()

Make sure child and parent traversals of specs work.

test_unsatisfiable_architecture(set_dependency)
test_unsatisfiable_compiler(set_dependency)
test_unsatisfiable_compiler_version(set_dependency)
test_unsatisfiable_version(set_dependency)
spack.test.spec_dag.saved_deps()

Returns a dictionary to save the dependencies.

spack.test.spec_dag.set_dependency(saved_deps)

Returns a function that alters the dependency information for a package.

spack.test.spec_semantics module

class spack.test.spec_semantics.TestSpecSematics

Bases: object

This tests satisfies(), constrain() and other semantic operations on specs.

pytestmark = [<MarkDecorator 'usefixtures' {'args': ('config', 'builtin_mock'), 'kwargs': {}}>]
test_constrain_architecture()
test_constrain_changed()
test_constrain_compiler()
test_constrain_compiler_flags()
test_constrain_dependency_changed()
test_constrain_dependency_not_changed()
test_constrain_not_changed()
test_constrain_variants()
test_copy_satisfies_transitive()
test_dep_index()
test_invalid_constraint()
test_satisfies()
test_satisfies_architecture()
test_satisfies_compiler()
test_satisfies_compiler_version()
test_satisfies_dependencies()
test_satisfies_dependency_versions()
test_satisfies_matching_compiler_flag()
test_satisfies_matching_variant()
test_satisfies_namespace()
test_satisfies_namespaced_dep()

Ensure spec from same or unspecified namespace satisfies namespace constraint.

test_satisfies_same_spec_with_different_hash()

Ensure that concrete specs are matched exactly by hash.

test_satisfies_unconstrained_compiler_flag()
test_satisfies_unconstrained_variant()
test_satisfies_virtual()
test_satisfies_virtual_dep_with_virtual_constraint()

Ensure we can satisfy virtual constraints when there are multiple vdep providers in the specs.

test_satisfies_virtual_dependencies()
test_satisfies_virtual_dependency_versions()
test_self_index()
test_spec_contains_deps()
test_unsatisfiable_compiler_flag()
test_unsatisfiable_compiler_flag_mismatch()
test_unsatisfiable_variant_mismatch()
test_unsatisfiable_variants()
test_virtual_index()
spack.test.spec_semantics.check_constrain(expected, spec, constraint)
spack.test.spec_semantics.check_constrain_changed(spec, constraint)
spack.test.spec_semantics.check_constrain_not_changed(spec, constraint)
spack.test.spec_semantics.check_invalid_constraint(spec, constraint)
spack.test.spec_semantics.check_satisfies(spec, anon_spec, concrete=False)
spack.test.spec_semantics.check_unsatisfiable(spec, anon_spec, concrete=False)

spack.test.spec_syntax module

class spack.test.spec_syntax.TestSpecSyntax

Bases: object

check_lex(tokens, spec)

Check that the provided spec parses to the provided token list.

check_parse(expected, spec=None, remove_arch=True)

Assert that the provided spec is able to be parsed.

If this is called with one argument, it assumes that the string is canonical (i.e., no spaces and ~ instead of - for variants) and that it will convert back to the string it came from.

If this is called with two arguments, the first argument is the expected canonical form and the second is a non-canonical input to be parsed.

test_ambiguous()
test_ambiguous_hash(database)
test_anonymous_specs()
test_canonicalize()
test_dep_spec_by_hash(database)
test_dependencies_with_versions()
test_duplicate_architecture()
test_duplicate_architecture_component()
test_duplicate_compiler()
test_duplicate_dependency()
test_duplicate_variant()
test_full_specs()
test_invalid_hash(database)
test_kv_with_quotes()
test_kv_with_spaces()
test_kv_without_quotes()
test_minimal_spaces()
test_multiple_specs()
test_multiple_specs_after_kv()
test_multiple_specs_long_second()
test_multiple_specs_with_hash(database)
test_nonexistent_hash(database)
test_package_names()
test_parse_errors()
test_redundant_spec(database)
test_simple_dependence()
test_spaces_between_dependences()
test_spaces_between_options()
test_spec_by_hash(database)
test_way_too_many_spaces()

spack.test.spec_yaml module

Test YAML serialization for specs.

YAML format preserves DAG informatoin in the spec.

spack.test.spec_yaml.check_yaml_round_trip(spec)
spack.test.spec_yaml.reverse_all_dicts(data)

Descend into data and reverse all the dictionaries

spack.test.spec_yaml.test_ambiguous_version_spec(builtin_mock)
spack.test.spec_yaml.test_concrete_spec(config, builtin_mock)
spack.test.spec_yaml.test_normal_spec(builtin_mock)
spack.test.spec_yaml.test_ordered_read_not_required_for_consistent_dag_hash(config, builtin_mock)

Make sure ordered serialization isn’t required to preserve hashes.

For consistent hashes, we require that YAML and json documents have their keys serialized in a deterministic order. However, we don’t want to require them to be serialized in order. This ensures that is not required.

spack.test.spec_yaml.test_simple_spec()
spack.test.spec_yaml.test_using_ordered_dict(builtin_mock)

Checks that dicts are ordered

Necessary to make sure that dag_hash is stable across python versions and processes.

spack.test.spec_yaml.test_yaml_subdag(config, builtin_mock)

spack.test.stage module

Test that the Stage class works correctly.

class spack.test.stage.TestStage

Bases: object

pytestmark = [<MarkDecorator 'usefixtures' {'args': ('builtin_mock',), 'kwargs': {}}>]
stage_name = 'spack-test-stage'
test_chdir(mock_archive)
test_expand_archive(mock_archive)
test_expand_archive_with_chdir(mock_archive)
test_fetch(mock_archive)
test_keep_exceptions(mock_archive)
test_keep_without_exceptions(mock_archive)
test_no_keep_with_exceptions(mock_archive)
test_no_keep_without_exceptions(mock_archive)
test_no_search_if_default_succeeds(mock_archive, failing_search_fn)
test_no_search_mirror_only(failing_fetch_strategy, failing_search_fn)
test_restage(mock_archive)
test_search_if_default_fails(failing_fetch_strategy, search_fn)
test_setup_and_destroy_name_with_tmp(mock_archive)
test_setup_and_destroy_name_without_tmp(mock_archive)
test_setup_and_destroy_no_name_with_tmp(mock_archive)
test_setup_and_destroy_no_name_without_tmp(mock_archive)
spack.test.stage.check_chdir(stage, stage_name)
spack.test.stage.check_chdir_to_source(stage, stage_name)
spack.test.stage.check_destroy(stage, stage_name)

Figure out whether a stage was destroyed correctly.

spack.test.stage.check_expand_archive(stage, stage_name, mock_archive)
spack.test.stage.check_fetch(stage, stage_name)
spack.test.stage.check_setup(stage, stage_name, archive)

Figure out whether a stage was set up correctly.

spack.test.stage.failing_fetch_strategy()

Returns a fetch strategy that fails.

spack.test.stage.failing_search_fn()

Returns a search function that fails! Always!

spack.test.stage.get_stage_path(stage, stage_name)

Figure out where a stage should be living. This depends on whether it’s named.

spack.test.stage.mock_archive(tmpdir, monkeypatch)

Creates a mock archive with the structure expected by the tests

spack.test.stage.search_fn()

Returns a search function that always succeeds.

spack.test.stage.tmpdir_for_stage(mock_archive)

Uses a temporary directory for staging

spack.test.svn_fetch module

spack.test.svn_fetch.test_fetch(type_of_test, mock_svn_repository, config, refresh_builtin_mock)

Tries to:

  1. Fetch the repo using a fetch strategy constructed with supplied args (they depend on type_of_test).
  2. Check if the test_file is in the checked out repository.
  3. Assert that the repository is at the revision supplied.
  4. Add and remove some files, then reset the repo, and ensure it’s all there again.
spack.test.svn_fetch.type_of_test(request)

Returns one of the test type available for the mock_hg_repository

spack.test.url_extrapolate module

Tests ability of spack to extrapolate URL versions from existing versions.

class spack.test.url_extrapolate.UrlExtrapolateTest(methodName='runTest')

Bases: unittest.case.TestCase

check_url(base, version, new_url)
test_dyninst_version()
test_gcc()
test_github_raw()
test_libdwarf_version()
test_libelf_version()
test_mpileaks_version()
test_partial_version_prefix()
test_scalasca_partial_version()

spack.test.url_parse module

This file has a bunch of versions tests taken from the excellent version detection in Homebrew.

class spack.test.url_parse.UrlParseTest(methodName='runTest')

Bases: unittest.case.TestCase

assert_not_detected(string)
check(name, v, string, **kwargs)
test_angband_version_style()
test_another_erlang_version_style()
test_apache_version_style()
test_astyle_verson_style()
test_boost_version_style()
test_dash_rc_style()
test_dash_version_dash_style()
test_debian_style_1()
test_debian_style_2()
test_erlang_version_style()
test_fann_version()
test_gcc_version()
test_gcc_version_precedence()
test_github_raw_url()
test_gloox_beta_style()
test_haxe_version()
test_hdf5_version()
test_iges_version()
test_imagemagick_style()
test_imap_version()
test_jpeg_style()
test_lame_version_style()
test_luaposix_version()
test_mpileaks_version()
test_mvapich2_19_version()
test_mvapich2_20_version()
test_nco_version()
test_new_github_style()
test_no_version()
test_noseparator_single_digit()
test_omega_version_style()
test_openssl_version()
test_p7zip_version_style()
test_pypy_version()
test_r_xml_version()
test_rc_style()
test_ruby_version_style()
test_scalasca_version()
test_sionlib_version()
test_sphinx_beta_style()
test_stable_suffix()
test_suite3270_version()
test_synergy_version()
test_version_all_dots()
test_version_developer_that_hates_us_format()
test_version_dos2unix()
test_version_github()
test_version_github_with_high_patch_number()
test_version_gitlab()
test_version_internal_dash()
test_version_regular()
test_version_single_digit()
test_version_sourceforge_download()
test_version_underscore_separator()
test_wwwoffle_version()
test_xaw3d_version()
test_yet_another_erlang_version_style()
test_yet_another_version()
test_yorick_version()

spack.test.url_substitution module

This test does sanity checks on substituting new versions into URLs

class spack.test.url_substitution.PackageSanityTest(methodName='runTest')

Bases: unittest.case.TestCase

test_hypre_url_substitution()
test_otf2_url_substitution()

spack.test.versions module

These version tests were taken from the RPM source code. We try to maintain compatibility with RPM’s version semantics where it makes sense.

class spack.test.versions.VersionsTest(methodName='runTest')

Bases: unittest.case.TestCase

assert_canonical(canonical_list, version_list)
assert_does_not_satisfy(v1, v2)
assert_in(needle, haystack)
assert_no_overlap(v1, v2)
assert_not_in(needle, haystack)
assert_overlaps(v1, v2)
assert_satisfies(v1, v2)
assert_ver_eq(a, b)
assert_ver_gt(a, b)
assert_ver_lt(a, b)
check_intersection(expected, a, b)
check_union(expected, a, b)
test_alpha()
test_alpha_beta()
test_alpha_with_dots()
test_basic_version_satisfaction()
test_basic_version_satisfaction_in_lists()
test_canonicalize_list()
test_close_numbers()
test_contains()
test_date_stamps()
test_double_alpha()
test_formatted_strings()
test_get_item()
test_in_list()
test_intersect_with_containment()
test_intersection()
test_lists_overlap()
test_num_alpha_with_no_separator()
test_nums_and_patch()
test_overlap_with_containment()
test_padded_numbers()
test_patch()
test_ranges_overlap()
test_rc_versions()
test_repr_and_str()
test_rpm_oddities()
test_satisfaction_with_lists()
test_three_segments()
test_two_segments()
test_underscores()
test_union_with_containment()
test_version_range_satisfaction()
test_version_range_satisfaction_in_lists()
test_version_ranges()

Module contents