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_environment module

spack.test.build_environment.build_environment(working_env)
spack.test.build_environment.test_cc_not_changed_by_modules(monkeypatch, working_env)
spack.test.build_environment.test_compiler_config_modifications(monkeypatch, working_env)
spack.test.build_environment.test_package_inheritance_module_setup(config, mock_packages, working_env)
spack.test.build_environment.test_parallel_false_is_not_propagating(config, mock_packages)
spack.test.build_environment.test_set_build_environment_variables(config, mock_packages, working_env, monkeypatch, installation_dir_with_headers)

Check that build_environment supplies the needed library/include directories via the SPACK_LINK_DIRS and SPACK_INCLUDE_DIRS environment variables.

spack.test.build_environment.test_spack_paths_before_module_paths(config, mock_packages, monkeypatch, working_env)
spack.test.build_environment.test_static_to_shared_library(build_environment)

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

class spack.test.build_systems.TestAutotoolsPackage

ベースクラス: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_none_is_allowed()
test_with_or_without()
spack.test.build_systems.test_affirmative_make_check(directory, config, mock_packages, working_env)

Tests that Spack correctly detects targets in a Makefile.

spack.test.build_systems.test_affirmative_ninja_check(directory, config, mock_packages, working_env)

Tests that Spack correctly detects targets in a Ninja build script.

spack.test.build_systems.test_cmake_bad_generator(config, mock_packages)
spack.test.build_systems.test_cmake_secondary_generator(config, mock_packages)
spack.test.build_systems.test_cmake_std_args(config, mock_packages)
spack.test.build_systems.test_negative_make_check(directory, config, mock_packages, working_env)

Tests that Spack correctly ignores false positives in a Makefile.

spack.test.build_systems.test_negative_ninja_check(directory, config, mock_packages, working_env)

Tests that Spack correctly ignores false positives in a Ninja build script.

spack.test.cc module

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

spack.test.cc.check_args(cc, args, expected)

Check output arguments that cc produces when called with args.

This assumes that cc will print debug command output with one element per line, so that we see whether arguments that should (or shouldn't) contain spaces are parsed correctly.

spack.test.cc.dump_mode(cc, args)

Make cc dump the mode it detects, and return it.

spack.test.cc.pkg_prefix = '/spack-test-prefix'

The prefix of the package being mock installed

spack.test.cc.real_cc = '/bin/mycc'

the "real" compiler the wrapper is expected to invoke

spack.test.cc.test_as_mode()
spack.test.cc.test_cc_deps()

Ensure -L and RPATHs are not added in cc mode.

spack.test.cc.test_cc_flags(wrapper_flags)
spack.test.cc.test_ccache_prepend_for_cc()
spack.test.cc.test_ccld_deps()

Ensure all flags are added in ccld mode.

spack.test.cc.test_ccld_mode()
spack.test.cc.test_ccld_with_system_dirs()

Ensure all flags are added in ccld mode.

spack.test.cc.test_cpp_flags(wrapper_flags)
spack.test.cc.test_cpp_mode()
spack.test.cc.test_cxx_flags(wrapper_flags)
spack.test.cc.test_dep_include()

Ensure a single dependency include directory is added.

spack.test.cc.test_dep_lib()

Ensure a single dependency RPATH is added.

spack.test.cc.test_dep_lib_no_lib()

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

spack.test.cc.test_dep_lib_no_rpath()

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

spack.test.cc.test_dep_rpath()

Ensure RPATHs for root package are added.

spack.test.cc.test_fc_flags(wrapper_flags)
spack.test.cc.test_ld_deps()

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

Ensure SPACK_RPATH_DEPS controls -rpath for ld.

spack.test.cc.test_ld_deps_no_rpath()

Ensure SPACK_LINK_DEPS controls -L for ld.

spack.test.cc.test_ld_deps_partial()

Make sure ld -r (partial link) is handled correctly on OS's where it doesn't accept rpaths.

spack.test.cc.test_ld_flags(wrapper_flags)
spack.test.cc.test_ld_mode()
spack.test.cc.test_no_ccache_prepend_for_fc()
spack.test.cc.test_vcheck_mode()
spack.test.cc.wrapper_environment()
spack.test.cc.wrapper_flags()

spack.test.cmd_extensions module

spack.test.cmd_extensions.extension_root(tmpdir)
spack.test.cmd_extensions.hello_world_cmd(extension_root)

Simple extension command with code contained in a single file.

spack.test.cmd_extensions.hello_world_with_module_in_root(extension_root)

Extension command with additional code in the root folder.

spack.test.cmd_extensions.test_command_with_import(hello_world_with_module_in_root)
spack.test.cmd_extensions.test_simple_command_extension(hello_world_cmd)

spack.test.compilers module

class spack.test.compilers.MockCompiler

ベースクラス: spack.compiler.Compiler

name
version
spack.test.compilers.flag_value(flag, spec)
spack.test.compilers.supported_flag_test(flag, flag_value_ref, spec=None)
spack.test.compilers.test_all_compilers(config)
spack.test.compilers.test_arm_version_detection(version_str, expected_version)
spack.test.compilers.test_cce_flags()
spack.test.compilers.test_cce_version_detection(version_str, expected_version)
spack.test.compilers.test_clang_flags()
spack.test.compilers.test_clang_version_detection(version_str, expected_version)
spack.test.compilers.test_compiler_flags_from_config_are_grouped()
spack.test.compilers.test_default_flags()
spack.test.compilers.test_fj_flags()
spack.test.compilers.test_fj_version_detection(version_str, expected_version)
spack.test.compilers.test_gcc_flags()
spack.test.compilers.test_gcc_version_detection(version_str, expected_version)
spack.test.compilers.test_get_compiler_duplicates(config)
spack.test.compilers.test_intel_flags()
spack.test.compilers.test_intel_version_detection(version_str, expected_version)
spack.test.compilers.test_nag_flags()
spack.test.compilers.test_nag_version_detection(version_str, expected_version)
spack.test.compilers.test_pgi_flags()
spack.test.compilers.test_pgi_version_detection(version_str, expected_version)
spack.test.compilers.test_version_detection_is_empty()
spack.test.compilers.test_version_detection_is_successful()
spack.test.compilers.test_xl_flags()
spack.test.compilers.test_xl_r_flags()
spack.test.compilers.test_xl_version_detection(version_str, expected_version)
spack.test.compilers.unsupported_flag_test(flag, spec=None)

spack.test.concretize module

class spack.test.concretize.TestConcretize

ベースクラス: object

concretize_difficult_packages(a, b)

Test a couple of large packages that are often broken due to current limitations in the concretizer

concretize_multi_provider()
pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_architecture_deep_inheritance()

Make sure that indirect dependencies receive architecture information from the root even when partial architecture information is provided by an intermediate dependency.

test_architecture_inheritance()

test_architecture_inheritance is likely to fail with an UnavailableCompilerVersionError if the architecture is concretized incorrectly.

test_compiler_child()
test_compiler_flags_from_user_are_grouped()
test_compiler_inheritance()
test_concretize(spec)
test_concretize_enable_disable_compiler_existence_check()
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(mutable_mock_packages)

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_conflicts_in_spec(conflict_spec)
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(mock_config)
test_nobuild_package()
test_provides_handles_multiple_providers_of_same_vesrion()
test_regression_issue_4492()
test_regression_issue_7239()
test_regression_issue_7705()
test_regression_issue_7941()
test_simultaneous_concretization_of_specs(abstract_specs)
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

ベースクラス: object

pytestmark = [Mark(name='usefixtures', args=('concretize_scope', 'mock_packages'), kwargs={})]
test_all_is_not_a_virtual()

Verify that all is allowed in packages.yaml.

test_config_permissions_differ_read_write(configure_permissions)
test_config_permissions_from_all(configure_permissions)
test_config_permissions_from_package(configure_permissions)
test_config_perms_fail_write_gt_read(configure_permissions)
test_develop()

Test concretization with develop-like versions

test_external_mpi()
test_no_virtuals_in_packages_yaml()

Verify that virtuals are not allowed in packages.yaml.

test_preferred()

"Test packages with some version marked as preferred=True

test_preferred_compilers(mutable_mock_packages)

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

test_preferred_versions_mixed_version_types()
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.configure_permissions()
spack.test.concretize_preferences.update_packages(pkgname, section, value)

Update config and reread package list

spack.test.config module

spack.test.config.check_compiler_config(comps, *compiler_names)

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

spack.test.config.check_schema(name, file_contents)

Check a Spack YAML schema against some data

spack.test.config.compiler_specs()

Returns a couple of compiler specs needed for the tests

spack.test.config.get_config_error(filename, schema, yaml_string)

Parse a YAML string and return the resulting ConfigFormatError.

Fail if there is no ConfigFormatError

spack.test.config.test_add_command_line_scopes(tmpdir, mutable_config)
spack.test.config.test_bad_command_line_scopes(tmpdir, mock_config)
spack.test.config.test_bad_compilers_yaml(tmpdir)
spack.test.config.test_bad_config_section(mock_config)

Test that getting or setting a bad section gives an error.

spack.test.config.test_bad_config_yaml(tmpdir)
spack.test.config.test_bad_env_yaml(tmpdir)
spack.test.config.test_bad_mirrors_yaml(tmpdir)
spack.test.config.test_bad_repos_yaml(tmpdir)
spack.test.config.test_config_format_error(mutable_config)

This is raised when we try to write a bad configuration.

spack.test.config.test_config_parse_dict_in_list(tmpdir)
spack.test.config.test_config_parse_list_in_dict(tmpdir)
spack.test.config.test_config_parse_str_not_bool(tmpdir)
spack.test.config.test_good_env_yaml(tmpdir)
spack.test.config.test_immutable_scope(tmpdir)
spack.test.config.test_internal_config_filename(mock_config, write_config_file)
spack.test.config.test_internal_config_from_data()
spack.test.config.test_internal_config_update(mock_config, write_config_file)
spack.test.config.test_keys_are_ordered()

Test that keys in Spack YAML files retain their order from the file.

spack.test.config.test_mark_internal()
spack.test.config.test_merge_with_defaults(mock_config, write_config_file)

This ensures that specified preferences merge with defaults as expected. Originally all defaults were initialized with the exact same object, which led to aliasing problems. Therefore the test configs used here leave 'version' blank for multiple packages in 'packages_merge_low'.

spack.test.config.test_read_config(mock_config, write_config_file)
spack.test.config.test_read_config_merge_list(mock_config, write_config_file)
spack.test.config.test_read_config_override_all(mock_config, write_config_file)
spack.test.config.test_read_config_override_key(mock_config, write_config_file)
spack.test.config.test_read_config_override_list(mock_config, write_config_file)
spack.test.config.test_single_file_scope(tmpdir, config)
spack.test.config.test_substitute_config_variables(mock_config)
spack.test.config.test_substitute_tempdir(mock_config)
spack.test.config.test_substitute_user(mock_config)
spack.test.config.test_write_key_in_memory(mock_config, compiler_specs)
spack.test.config.test_write_key_to_disk(mock_config, compiler_specs)
spack.test.config.test_write_list_in_memory(mock_config)
spack.test.config.test_write_to_same_priority_file(mock_config, compiler_specs)
spack.test.config.write_config_file(tmpdir)

Returns a function that writes a config file.

spack.test.conftest module

class spack.test.conftest.MockLayout(root)

ベースクラス: object

check_installed(spec)
path_for_spec(spec)
class spack.test.conftest.MockPackage(name, dependencies, dependency_types, conditions=None, versions=None)

ベースクラス: object

class spack.test.conftest.MockPackageMultiRepo(packages)

ベースクラス: object

exists(name)
get(spec)
get_pkg_class(name)
is_virtual(name)
repo_for_pkg(name)
spack.test.conftest.check_for_leftover_stage_files(request, mock_stage, ignore_stage_files)

Ensure that each test leaves a clean stage when done.

This can be disabled for tests that are expected to dirty the stage by adding:

@pytest.mark.disable_clean_stage_check

to tests that need it.

spack.test.conftest.clean_user_environment()
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.conflict_spec(request)

Specs which violate constraints specified with the "conflicts" directive in the "conflict" package.

spack.test.conftest.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.

spack.test.conftest.gen_mock_layout(tmpdir)
spack.test.conftest.ignore_stage_files()

Session-scoped helper for check_for_leftover_stage_files.

Used to track which leftover files in the stage have been seen.

spack.test.conftest.install_mockery(tmpdir, config, mock_packages)

Hooks a fake install directory, DB, and stage directory into Spack.

spack.test.conftest.installation_dir_with_headers(tmpdir_factory)

Mock installation tree with a few headers placed in different subdirectories. Shouldn't be modified by tests as it is session scoped.

spack.test.conftest.invalid_spec(request)

Specs that do not parse cleanly due to invalid formatting.

spack.test.conftest.linux_os()

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

spack.test.conftest.mock_archive(tmpdir_factory)

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_config(tmpdir)

Mocks two configuration scopes: 'low' and 'high'.

spack.test.conftest.mock_fetch(mock_archive)

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

spack.test.conftest.mock_fetch_cache(monkeypatch)

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

spack.test.conftest.mock_git_repository(tmpdir_factory)

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

spack.test.conftest.mock_hg_repository(tmpdir_factory)

Creates a very simple hg repository with two commits.

spack.test.conftest.mock_packages(repo_path)

Use the 'builtin.mock' repository instead of 'builtin'

spack.test.conftest.mock_stage(tmpdir_factory)

Mocks up a fake stage directory for use by tests.

spack.test.conftest.mock_svn_repository(tmpdir_factory)

Creates a very simple svn repository with two commits.

spack.test.conftest.module_configuration(monkeypatch, request)

Reads the module configuration file from the mock ones prepared for tests and monkeypatches the right classes to hook it in.

spack.test.conftest.mutable_config(tmpdir_factory, configuration_dir, config)

Like config, but tests can modify the configuration.

spack.test.conftest.mutable_database(database)

For tests that need to modify the database instance.

spack.test.conftest.mutable_mock_env_path(tmpdir_factory)

Fixture for mocking the internal spack environments directory.

spack.test.conftest.mutable_mock_packages(mock_packages, repo_path)

Function-scoped mock packages, for tests that need to modify them.

spack.test.conftest.no_chdir()

Ensure that no test changes Spack's working dirctory.

This prevents Spack tests (and therefore Spack commands) from changing the working directory and causing other tests to fail mysteriously. Tests should use working_dir or py.path's .as_cwd() instead of os.chdir to avoid failing this check.

We assert that the working directory hasn't changed, unless the original wd somehow ceased to exist.

spack.test.conftest.pytest_addoption(parser)
spack.test.conftest.pytest_collection_modifyitems(config, items)
spack.test.conftest.remove_whatever_it_is(path)

Type-agnostic remove.

spack.test.conftest.repo_path()

Session scoped RepoPath object pointing to the mock repository

spack.test.conftest.working_env()

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(mutable_database)
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_115_reindex_with_packages_not_in_repo(mutable_database)
spack.test.database.test_add_to_upstream_after_downstream(upstream_and_downstream_db)

An upstream DB can add a package after it is installed in the downstream DB. When a package is recorded as installed in both, the results should refer to the downstream DB.

spack.test.database.test_default_queries(database)
spack.test.database.test_external_entries_in_db(database)
spack.test.database.test_installed_upstream(upstream_and_downstream_db)
spack.test.database.test_old_external_entries_prefix(mutable_database)
spack.test.database.test_recursive_upstream_dbs(tmpdir_factory, test_store, gen_mock_layout)
spack.test.database.test_regression_issue_8036(mutable_database, usr_folder_exists)
spack.test.database.test_removed_upstream_dep(upstream_and_downstream_db)
spack.test.database.test_store(tmpdir)
spack.test.database.upstream_and_downstream_db(tmpdir_factory, gen_mock_layout)
spack.test.database.usr_folder_exists(monkeypatch)

The /usr folder is assumed to be existing in some tests. This fixture makes it such that its existence is mocked, so we have no requirements on the system running tests.

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, mock_packages)

Test that finding specs within an install layout works.

spack.test.directory_layout.test_handle_unknown_package(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 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, 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 installed package can be read back in consistently, and finally that the directory can be removed by the directory layout.

spack.test.directory_layout.test_yaml_directory_layout_parameters(tmpdir, config)

This tests the various parameters that can be used to configure the install location

spack.test.environment_modifications module

spack.test.environment_modifications.env(prepare_environment_for_tests)

Returns an empty EnvironmentModifications object.

spack.test.environment_modifications.files_to_be_sourced()

Returns a list of files to be sourced

spack.test.environment_modifications.miscellaneous_paths()

Returns a list of paths, including system ones.

spack.test.environment_modifications.prepare_environment_for_tests()

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

spack.test.environment_modifications.test_append_flags(env)

Tests appending to a value in the environment.

spack.test.environment_modifications.test_clear(env)
spack.test.environment_modifications.test_exclude_paths_from_inspection()
spack.test.environment_modifications.test_extend(env)

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

spack.test.environment_modifications.test_extra_arguments(env)

Tests that we can attach extra arguments to any command.

spack.test.environment_modifications.test_filter_system_paths(miscellaneous_paths)

Tests that the filtering of system paths works as expected.

spack.test.environment_modifications.test_inspect_path(tmpdir)
spack.test.environment_modifications.test_path_manipulation(env)

Tests manipulating list of paths in the environment.

spack.test.environment_modifications.test_preserve_environment(prepare_environment_for_tests)
spack.test.environment_modifications.test_set(env)

Tests setting values in the environment.

spack.test.environment_modifications.test_set_path(env)

Tests setting paths in an environment variable.

spack.test.environment_modifications.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_modifications.test_unset(env)

Tests unsetting values in the environment.

spack.test.flag_handlers module

class spack.test.flag_handlers.TestFlagHandlers

ベースクラス: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_add_build_system_flags_autotools(temp_env)
test_add_build_system_flags_cmake(temp_env)
test_build_system_flags_autotools(temp_env)
test_build_system_flags_cmake(temp_env)
test_build_system_flags_not_implemented(temp_env)
test_env_flags(temp_env)
test_inject_flags(temp_env)
test_ld_flags_cmake(temp_env)
test_ld_libs_cmake(temp_env)
test_no_build_system_flags(temp_env)
test_unbound_method(temp_env)
spack.test.flag_handlers.add_o3_to_build_system_cflags(pkg, name, flags)
spack.test.flag_handlers.temp_env()

spack.test.git_fetch module

spack.test.git_fetch.git_version(request)

Tests GitFetchStrategy behavior for different git versions.

GitFetchStrategy tries to optimize using features of newer git versions, but needs to work with older git versions. To ensure code paths for old versions still work, we fake it out here and make it use the backward-compatibility code paths with newer git versions.

spack.test.git_fetch.test_fetch(type_of_test, secure, mock_git_repository, config, mutable_mock_packages, git_version)

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.graph module

spack.test.graph.test_ascii_graph_mpileaks(mock_packages)

Test dynamically graphing the mpileaks package.

spack.test.graph.test_dynamic_dot_graph_mpileaks(mock_packages)

Test dynamically graphing the mpileaks package.

spack.test.graph.test_static_graph_mpileaks(mock_packages)

Test a static spack graph for a simple package.

spack.test.graph.test_topo_sort(mock_packages)

Test topo sort gives correct order.

spack.test.hg_fetch module

spack.test.hg_fetch.test_fetch(type_of_test, secure, mock_hg_repository, config, mutable_mock_packages)

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.install module

exception spack.test.install.MockInstallError(message, long_message=None)

ベースクラス: spack.error.SpackError

class spack.test.install.MockStage(wrapped_stage)

ベースクラス: object

create()
destroy()
class spack.test.install.RemovePrefixChecker(wrapped_rm_prefix)

ベースクラス: object

remove_prefix()
spack.test.install.mock_remove_prefix(*args)
spack.test.install.test_dont_add_patches_to_installed_package(install_mockery, mock_fetch)
spack.test.install.test_failing_build(install_mockery, mock_fetch)
spack.test.install.test_install_and_uninstall(install_mockery, mock_fetch)
spack.test.install.test_installed_dependency_request_conflicts(install_mockery, mock_fetch, mutable_mock_packages)
spack.test.install.test_installed_upstream(tmpdir_factory, install_mockery, mock_fetch, gen_mock_layout)

Check that when a dependency package is recorded as installed in an upstream database that it is not reinstalled.

spack.test.install.test_installed_upstream_external(tmpdir_factory, install_mockery, mock_fetch, gen_mock_layout)

Check that when a dependency package is recorded as installed in an upstream database that it is not reinstalled.

spack.test.install.test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch)
spack.test.install.test_partial_install_keep_prefix(install_mockery, mock_fetch)
spack.test.install.test_second_install_no_overwrite_first(install_mockery, mock_fetch)
spack.test.install.test_store(install_mockery, mock_fetch)

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

ベースクラス: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_make_explicit()
test_make_jobs_env()
test_make_normal()
test_make_one_job()
test_make_parallel_disabled()
test_make_parallel_false()
test_make_parallel_precedence()

spack.test.mirror module

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.mirror.test_all_mirror(mock_git_repository, mock_svn_repository, mock_hg_repository, mock_archive)
spack.test.mirror.test_git_mirror(mock_git_repository)
spack.test.mirror.test_hg_mirror(mock_hg_repository)
spack.test.mirror.test_mirror_with_url_patches(mock_packages, config, monkeypatch)
spack.test.mirror.test_svn_mirror(mock_svn_repository)
spack.test.mirror.test_url_mirror(mock_archive)

spack.test.module_parsing module

spack.test.module_parsing.module_function_test_mode()
spack.test.module_parsing.save_module_func()
spack.test.module_parsing.test_get_argument_from_module_line()
spack.test.module_parsing.test_get_path_from_module_contents()
spack.test.module_parsing.test_get_path_from_module_faked(save_module_func)
spack.test.module_parsing.test_module_function_change_env(tmpdir, working_env, module_function_test_mode)
spack.test.module_parsing.test_module_function_no_change(tmpdir, module_function_test_mode)
spack.test.module_parsing.test_pkg_dir_from_module_name()

spack.test.multimethod module

Test for multi_method dispatch.

spack.test.multimethod.pkg_name(request)

Make tests run on both multimethod and multimethod-inheritor.

This means we test all of our @when methods on a class that uses them directly, AND on a class that inherits them.

spack.test.multimethod.test_default_works(pkg_name)
spack.test.multimethod.test_dependency_match(pkg_name)
spack.test.multimethod.test_mpi_version(pkg_name)
spack.test.multimethod.test_multimethod_boolean(pkg_name)
spack.test.multimethod.test_multimethod_diamond_inheritance()
spack.test.multimethod.test_multimethod_inherited_and_overridden()
spack.test.multimethod.test_multimethod_with_base_class(pkg_name)
spack.test.multimethod.test_no_version_match(pkg_name)
spack.test.multimethod.test_one_version_match(pkg_name)
spack.test.multimethod.test_target_match(pkg_name)
spack.test.multimethod.test_undefined_mpi_version(pkg_name)
spack.test.multimethod.test_version_overlap(pkg_name)
spack.test.multimethod.test_virtual_dep_match(pkg_name)

spack.test.namespace_trie module

spack.test.namespace_trie.test_add_multiple(trie)
spack.test.namespace_trie.test_add_none_multiple(trie)
spack.test.namespace_trie.test_add_none_single(trie)
spack.test.namespace_trie.test_add_single(trie)
spack.test.namespace_trie.test_add_three(trie)
spack.test.namespace_trie.trie()

spack.test.optional_deps module

spack.test.optional_deps.spec_and_expected(request)

Parameters for the normalization test.

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

spack.test.package_hash module

spack.test.package_hash.compare_sans_name(eq, spec1, spec2)
spack.test.package_hash.test_all_same_but_archive_hash(tmpdir, mock_packages, config)

Archive hash is not intended to be reflected in Package hash.

spack.test.package_hash.test_all_same_but_install(tmpdir, mock_packages, config)
spack.test.package_hash.test_all_same_but_name(tmpdir, mock_packages, config)
spack.test.package_hash.test_all_same_but_patch_contents(tmpdir, mock_packages, config)
spack.test.package_hash.test_all_same_but_patches_to_apply(tmpdir, mock_packages, config)
spack.test.package_hash.test_different_variants(tmpdir, mock_packages, config)
spack.test.package_hash.test_hash(tmpdir, mock_packages, config)

spack.test.package_sanity module

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

spack.test.package_sanity.check_repo()

Get all packages in the builtin repo to make sure they work.

spack.test.package_sanity.test_all_versions_are_lowercase()

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

spack.test.package_sanity.test_all_virtual_packages_have_default_providers()

All virtual packages must have a default provider explicitly set.

spack.test.package_sanity.test_docstring()

Ensure that every package has a docstring.

spack.test.package_sanity.test_get_all_mock_packages()

Get the mock packages once each too.

spack.test.package_sanity.test_get_all_packages()

Get all packages once and make sure that works.

spack.test.package_sanity.test_no_fixme()

Packages should not contain any boilerplate such as FIXME or example.com.

spack.test.package_sanity.test_package_version_consistency()

Make sure all versions on builtin packages can produce a fetcher.

spack.test.packages module

class spack.test.packages.TestPackage

ベースクラス: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_all_same_but_archive_hash()
test_content_hash_all_same_but_patch_contents()
test_content_hash_different_variants()
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.packages.test_git_top_level(mock_packages, config)

Ensure that top-level git attribute can be used as a default.

spack.test.packages.test_git_url_top_level_conflicts(mock_packages, config)

Test git fetch strategy inference when url is specified with git.

spack.test.packages.test_git_url_top_level_git_versions(mock_packages, config)

Test git fetch strategy inference when url is specified with git.

spack.test.packages.test_git_url_top_level_url_versions(mock_packages, config)

Test URL fetch strategy inference when url is specified with git.

spack.test.packages.test_hg_top_level(mock_packages, config)

Ensure that top-level hg attribute can be used as a default.

spack.test.packages.test_no_extrapolate_without_url(mock_packages, config)

Verify that we can't extrapolate versions for non-URL packages.

spack.test.packages.test_svn_top_level(mock_packages, config)

Ensure that top-level svn attribute can be used as a default.

spack.test.packages.test_two_vcs_fetchers_top_level(mock_packages, config)

Verify conflict when two VCS strategies are specified together.

spack.test.packages.test_url_for_version_with_no_urls()
spack.test.packages.test_url_for_version_with_only_overrides(mock_packages, config)
spack.test.packages.test_url_for_version_with_only_overrides_with_gaps(mock_packages, config)
spack.test.packages.test_urls_for_versions(mock_packages, config)

Version directive without a 'url' argument should use default url.

spack.test.packaging module

This test checks the binary packaging infrastructure

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

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

spack.test.packaging.has_gnupg2()
spack.test.packaging.test_buildcache(mock_archive, tmpdir)
spack.test.packaging.test_elf_paths()
spack.test.packaging.test_macho_paths()
spack.test.packaging.test_needs_relocation()
spack.test.packaging.test_relocate_macho(tmpdir)
spack.test.packaging.test_relocate_text(tmpdir)
spack.test.packaging.testing_gpg_directory(tmpdir)

spack.test.patch module

spack.test.patch.check_multi_dependency_patch_specs(libelf, libdwarf, fake, owner, package_dir)

Validate patches on dependencies of patch-several-dependencies.

spack.test.patch.mock_stage(tmpdir, monkeypatch)
spack.test.patch.test_conditional_patched_dependencies(mock_packages, config)

Test whether conditional patched dependencies work.

spack.test.patch.test_conditional_patched_deps_with_conditions(mock_packages, config)

Test whether conditional patched dependencies with conditions work.

spack.test.patch.test_multiple_patched_dependencies(mock_packages, config)

Test whether multiple patched dependencies work.

spack.test.patch.test_nested_directives(mock_packages)

Ensure pkg data structures are set up properly by nested directives.

spack.test.patch.test_patch_in_spec(mock_packages, config)

Test whether patches in a package appear in the spec.

spack.test.patch.test_patch_order(mock_packages, config)
spack.test.patch.test_patched_dependency(mock_packages, config, install_mockery, mock_fetch)

Test whether patched dependencies work.

spack.test.patch.test_url_patch(mock_stage, filename, sha256, archive_sha256)
spack.test.patch.test_write_and_read_sub_dags_with_patched_deps(mock_packages, config)

Test whether patched dependencies are still correct after writing and reading a sub-DAG of a concretized Spec.

spack.test.pattern module

spack.test.pattern.composite(interface, implementation, request)

Returns a composite that contains an instance of implementation(1) and one of implementation(2).

spack.test.pattern.implementation(interface)

Returns an implementation of the interface

spack.test.pattern.interface()

Returns the interface class for the composite.

spack.test.pattern.test_composite_interface_calls(interface, composite)
spack.test.pattern.test_composite_no_methods()
spack.test.pattern.test_composite_wrong_container(interface)

spack.test.permissions module

spack.test.permissions.test_chmod_real_entries_ignores_suid_sgid(tmpdir)
spack.test.permissions.test_chmod_rejects_group_writable_suid(tmpdir)

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(mock_packages)
spack.test.provider_index.test_equal(mock_packages)
spack.test.provider_index.test_mpi_providers(mock_packages)
spack.test.provider_index.test_provider_index_round_trip(mock_packages)
spack.test.provider_index.test_providers_for_simple(mock_packages)

spack.test.python_version module

Check that Spack complies with minimum supported python versions.

We ensure that all Spack files work with Python2 >= 2.6 and Python3 >= 3.0.

We'd like to drop 2.6 support at some point, but there are still many HPC systems that ship with RHEL6/CentOS 6, which have Python 2.6 as the default version. Once those go away, we can likely drop 2.6 and increase the minimum supported Python 3 version, as well.

spack.test.python_version.check_python_versions(files)

Check that a set of Python files works with supported Ptyhon versions

spack.test.python_version.pyfiles(search_paths, exclude=())

Generator that yields all the python files in the search paths.

パラメータ
  • search_paths (list of str) -- list of paths to search for python files

  • exclude (list of str) -- file paths to exclude from search

列挙

python files in the search path.

spack.test.python_version.test_core_module_compatibility()

Test that all core spack modules work with supported Python versions.

spack.test.python_version.test_package_module_compatibility()

Test that all spack packages work with supported Python versions.

spack.test.relocate module

spack.test.relocate.is_relocatable(request)
spack.test.relocate.source_file(tmpdir, is_relocatable)

Returns the path to a source file of a relocatable executable.

spack.test.relocate.test_file_is_relocatable(source_file, is_relocatable)
spack.test.relocate.test_file_is_relocatable_errors(tmpdir)

spack.test.repo module

spack.test.repo.extra_repo(tmpdir_factory)
spack.test.repo.repo_for_test()
spack.test.repo.test_repo_getpkg(repo_for_test)
spack.test.repo.test_repo_last_mtime()
spack.test.repo.test_repo_multi_getpkg(repo_for_test, extra_repo)
spack.test.repo.test_repo_multi_getpkgclass(repo_for_test, extra_repo)
spack.test.repo.test_repo_pkg_with_unknown_namespace(repo_for_test)
spack.test.repo.test_repo_unknown_pkg(repo_for_test)

spack.test.sbang module

Test that Spack's shebang filtering works correctly.

class spack.test.sbang.ScriptDirectory

ベースクラス: object

Directory full of test scripts to run sbang instrumentation on.

destroy()
spack.test.sbang.script_dir()
spack.test.sbang.test_shebang_handles_non_writable_files(script_dir)
spack.test.sbang.test_shebang_handling(script_dir)

spack.test.schema module

spack.test.schema.module_suffixes_schema()
spack.test.schema.test_module_suffixes(module_suffixes_schema)
spack.test.schema.test_validate_spec(validate_spec_schema)
spack.test.schema.validate_spec_schema()

spack.test.spack_yaml module

Test Spack's custom YAML format.

spack.test.spack_yaml.data()

Returns the data loaded from a test file

spack.test.spack_yaml.test_dict_order(data)
spack.test.spack_yaml.test_line_numbers(data)
spack.test.spack_yaml.test_parse(data)
spack.test.spack_yaml.test_yaml_aliases()

spack.test.spec_dag module

These tests check Spec DAG operations using dummy packages.

class spack.test.spec_dag.TestSpecDag

ベースクラス: object

check_diamond_deptypes(spec)

Validate deptypes in dt-diamond spec.

This ensures that concretization works properly when two packages depend on the same dependency in different ways.

check_diamond_normalized_dag(spec)
pytestmark = [Mark(name='usefixtures', args=('mutable_mock_packages',), kwargs={})]
test_canonical_deptype()
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()

Ensure that it is possible to construct a spec with explicit dependency types.

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_invalid_literal_spec()
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 in the saved_deps fixture.

spack.test.spec_dag.test_conditional_dep_with_user_constraints()

This sets up packages X->Y such that X depends on Y conditionally. It then constructs a Spec with X but with no constraints on X, so that the initial normalization pass cannot determine whether the constraints are met to add the dependency; this checks whether a user-specified constraint on Y is applied properly.

spack.test.spec_dag.test_test_deptype()

Ensure that test-only dependencies are only included for specified packages in the following spec DAG:

  w
 /|
x y
  |
  z

w->y deptypes are (link, build), w->x and y->z deptypes are (test)

spack.test.spec_semantics module

class spack.test.spec_semantics.TestSpecSematics

ベースクラス: object

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

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_abstract_spec_prefix_error()
test_any_combination_of()
test_constrain_architecture()
test_constrain_changed()
test_constrain_compiler()
test_constrain_compiler_flags()
test_constrain_dependency_changed()
test_constrain_dependency_not_changed()
test_constrain_multi_value_variant()
test_constrain_not_changed()
test_constrain_variants()
test_copy_satisfies_transitive()
test_dep_index()
test_empty_satisfies()
test_errors_in_variant_directive()
test_exceptional_paths_for_constructor()
test_indirect_unsatisfied_single_valued_variant()
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_multi_value_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_single_valued_variant()

Tests that the case reported in https://github.com/spack/spack/pull/2386#issuecomment-282147639 is handled correctly.

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_spec_deprecated_formatting()
test_spec_flags_maintain_order()
test_spec_formatting()
test_spec_formatting_escapes()
test_unsatisfiable_compiler_flag()
test_unsatisfiable_compiler_flag_mismatch()
test_unsatisfiable_multi_value_variant()
test_unsatisfiable_variant_mismatch()
test_unsatisfiable_variant_types()
test_unsatisfiable_variants()
test_unsatisfied_single_valued_variant()
test_virtual_index()
spack.test.spec_semantics.argument_factory(argument_spec, left)
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(target_spec, argument_spec, target_concrete=False)
spack.test.spec_semantics.check_unsatisfiable(target_spec, argument_spec, target_concrete=False)
spack.test.spec_semantics.target_factory(spec_string, target_concrete)

spack.test.spec_set module

spack.test.spec_set.test_compiler_specs()
spack.test.spec_set.test_package_specs()
spack.test.spec_set.test_spec_set_basic()

The "include" isn't required, but if it is present, we should only see specs mentioned there. Also, if we include cdash and project properties, those should be captured and stored on the resulting CombinatorialSpecSet as attributes.

spack.test.spec_set.test_spec_set_exclude()

The exclude property isn't required, but if it appears, any specs mentioned there should not appear in the output specs

spack.test.spec_set.test_spec_set_get_cdash_array()

Make sure we can handle multiple cdash sites in a list

spack.test.spec_set.test_spec_set_include_exclude_conflict()

Exclude should override include

spack.test.spec_set.test_spec_set_include_limited_packages()

If we see the include key, it is a filter and only the specs mentioned there should actually be included.

spack.test.spec_set.test_spec_set_no_include()

Make sure that without any exclude or include, we get the full cross- product of specs/versions.

spack.test.spec_set.test_spec_set_packages_no_matrix()

The matrix property is required, make sure we error out if it is missing

spack.test.spec_set.test_spec_set_simple_spec_list()

Make sure we can handle the slightly more concise syntax where we include the package name/version together and skip the extra keys in the dictionary.

spack.test.spec_set.test_spec_set_with_specs()

Make sure we only see the specs mentioned in the include

spack.test.spec_syntax module

class spack.test.spec_syntax.TestSpecSyntax

ベースクラス: object

check_lex(tokens, spec)

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

check_parse(expected, spec=None)

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

Ensure we get errors for nonexistant hashes.

test_package_names()
test_parse_errors()
test_redundant_spec(database)

Check that redundant spec constraints raise errors.

TODO (TG): does this need to be an error? Or should concrete specs only raise errors if constraints cause a contradiction?

test_simple_dependence()
test_spaces_between_dependences()
test_spaces_between_options()
test_spec_by_hash(database)
test_way_too_many_spaces()
spack.test.spec_syntax.test_parse_anonymous_specs(spec, anon_spec, spec_name)

spack.test.spec_yaml module

Test YAML serialization for specs.

YAML format preserves DAG information in the spec.

spack.test.spec_yaml.check_specs_equal(original_spec, spec_yaml_path)
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(mock_packages)
spack.test.spec_yaml.test_concrete_spec(config, mock_packages)
spack.test.spec_yaml.test_external_spec(config, mock_packages)
spack.test.spec_yaml.test_normal_spec(mock_packages)
spack.test.spec_yaml.test_ordered_read_not_required_for_consistent_dag_hash(config, mock_packages)

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_save_dependency_spec_yamls_subset(tmpdir, config)
spack.test.spec_yaml.test_simple_spec()
spack.test.spec_yaml.test_using_ordered_dict(mock_packages)

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_multivalue()
spack.test.spec_yaml.test_yaml_subdag(config, mock_packages)

spack.test.stage module

Test that the Stage class works correctly.

class spack.test.stage.TestStage

ベースクラス: object

pytestmark = [Mark(name='usefixtures', args=('mock_packages',), kwargs={})]
stage_name = 'spack-test-stage'
test_composite_stage_with_expand_resource(mock_archive, mock_expand_resource, composite_stage_with_expanding_resource)
test_composite_stage_with_noexpand_resource(mock_archive, mock_noexpand_resource)
test_expand_archive(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_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.composite_stage_with_expanding_resource(mock_archive, mock_expand_resource)
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.mock_expand_resource(tmpdir)
spack.test.stage.mock_noexpand_resource(tmpdir)
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, secure, mock_svn_repository, config, mutable_mock_packages)

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.tengine module

class spack.test.tengine.TestContext

ベースクラス: object

class A

ベースクラス: spack.tengine.Context

context_properties = ['foo']
foo
class B

ベースクラス: spack.tengine.Context

bar
context_properties = ['bar']
class C

ベースクラス: spack.test.tengine.A, spack.test.tengine.B

context_properties = ['foobar', 'foo', 'bar']
foo
foobar
test_to_dict()

Tests that all the context properties in a hierarchy are considered when building the context dictionary.

class spack.test.tengine.TestTengineEnvironment

ベースクラス: object

pytestmark = [Mark(name='usefixtures', args=('config',), kwargs={})]
test_template_retrieval()

Tests the template retrieval mechanism hooked into config files

spack.test.test_activations module

spack.test.test_activations.builtin_and_mock_packages()
spack.test.test_activations.create_dir_structure(tmpdir, dir_structure)
spack.test.test_activations.create_ext_pkg(name, prefix, extendee_spec)
spack.test.test_activations.create_python_ext_pkg(name, prefix, python_spec, namespace=None)
spack.test.test_activations.namespace_extensions(tmpdir, builtin_and_mock_packages)
spack.test.test_activations.perl_and_extension_dirs(tmpdir, builtin_and_mock_packages)
spack.test.test_activations.python_and_extension_dirs(tmpdir, builtin_and_mock_packages)
spack.test.test_activations.test_perl_activation(tmpdir, builtin_and_mock_packages)
spack.test.test_activations.test_perl_activation_view(tmpdir, perl_and_extension_dirs, builtin_and_mock_packages)
spack.test.test_activations.test_perl_activation_with_files(tmpdir, perl_and_extension_dirs, builtin_and_mock_packages)
spack.test.test_activations.test_python_activation_view(tmpdir, python_and_extension_dirs, builtin_and_mock_packages)
spack.test.test_activations.test_python_activation_with_files(tmpdir, python_and_extension_dirs, builtin_and_mock_packages)
spack.test.test_activations.test_python_ignore_namespace_init_conflict(tmpdir, namespace_extensions, builtin_and_mock_packages)

Test the view update logic in PythonPackage ignores conflicting instances of __init__ for packages which are in the same namespace.

spack.test.test_activations.test_python_keep_namespace_init(tmpdir, namespace_extensions, builtin_and_mock_packages)

Test the view update logic in PythonPackage keeps the namespace __init__ file as long as one package in the namespace still exists.

spack.test.test_activations.test_python_namespace_conflict(tmpdir, namespace_extensions, builtin_and_mock_packages)

Test the view update logic in PythonPackage reports an error when two python extensions with different namespaces have a conflicting __init__ file.

spack.test.url_fetch module

spack.test.url_fetch.checksum_type(request)
spack.test.url_fetch.test_fetch(mock_archive, secure, checksum_type, config, mutable_mock_packages)

Fetch an archive and make sure we can checksum it.

spack.test.url_fetch.test_from_list_url(mock_packages, config)
spack.test.url_fetch.test_hash_detection(checksum_type)
spack.test.url_fetch.test_unknown_hash(checksum_type)

spack.test.url_parse module

Tests Spack's ability to parse the name and version of a package based on its URL.

spack.test.url_parse.test_no_version(not_detectable_url)
spack.test.url_parse.test_url_parse_name_and_version(name, version, url)
spack.test.url_parse.test_url_parse_offset(name, noffset, ver, voffset, path)

Tests that the name, version and offsets are computed correctly.

パラメータ
  • name (str) -- expected name

  • noffset (int) -- name offset

  • ver (str) -- expected version

  • voffset (int) -- version offset

  • path (str) -- url to be parsed

spack.test.url_parse.test_url_strip_name_suffixes(url, version, expected)
spack.test.url_parse.test_url_strip_version_suffixes(url, expected)

spack.test.url_substitution module

Tests Spack's ability to substitute a different version into a URL.

spack.test.url_substitution.test_url_substitution(base_url, version, expected)

spack.test.variant module

class spack.test.variant.TestBoolValuedVariant

ベースクラス: object

test_compatible()
test_constrain()
test_initialization()
test_satisfies()
test_yaml_entry()
class spack.test.variant.TestMultiValuedVariant

ベースクラス: object

test_compatible()
test_constrain()
test_initialization()
test_satisfies()
test_yaml_entry()
class spack.test.variant.TestSingleValuedVariant

ベースクラス: object

test_compatible()
test_constrain()
test_initialization()
test_satisfies()
test_yaml_entry()
class spack.test.variant.TestVariant

ベースクラス: object

test_callable_validator()
test_representation()
test_validation()
class spack.test.variant.TestVariantMapTest

ベースクラス: object

test_copy()
test_invalid_values()
test_satisfies_and_constrain()
test_set_item()
test_str()
test_substitute()
spack.test.variant.test_disjoint_set_fluent_methods()
spack.test.variant.test_disjoint_set_initialization()
spack.test.variant.test_disjoint_set_initialization_errors()
spack.test.variant.test_from_node_dict()

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.

spack.test.versions.assert_canonical(canonical_list, version_list)

Asserts that a redundant list is reduced to canonical form.

spack.test.versions.assert_does_not_satisfy(v1, v2)

Asserts that 'v1' does not satisfy 'v2'.

spack.test.versions.assert_in(needle, haystack)

Asserts that 'needle' is in 'haystack'.

spack.test.versions.assert_no_overlap(v1, v2)

Asserts that two version ranges do not overlap.

spack.test.versions.assert_not_in(needle, haystack)

Asserts that 'needle' is not in 'haystack'.

spack.test.versions.assert_overlaps(v1, v2)

Asserts that two version ranges overlaps.

spack.test.versions.assert_satisfies(v1, v2)

Asserts that 'v1' satisfies 'v2'.

spack.test.versions.assert_ver_eq(a, b)

Asserts the results of comparisons when 'a' is equal to 'b'.

spack.test.versions.assert_ver_gt(a, b)

Asserts the results of comparisons when 'a' is greater than 'b'.

spack.test.versions.assert_ver_lt(a, b)

Asserts the results of comparisons when 'a' is less than 'b'.

spack.test.versions.check_intersection(expected, a, b)

Asserts that 'a' intersect 'b' == 'expected'.

spack.test.versions.check_union(expected, a, b)

Asserts that 'a' union 'b' == 'expected'.

spack.test.versions.test_alpha()
spack.test.versions.test_alpha_beta()
spack.test.versions.test_alpha_with_dots()
spack.test.versions.test_basic_version_satisfaction()
spack.test.versions.test_basic_version_satisfaction_in_lists()
spack.test.versions.test_canonicalize_list()
spack.test.versions.test_close_numbers()
spack.test.versions.test_contains()
spack.test.versions.test_date_stamps()
spack.test.versions.test_develop()
spack.test.versions.test_double_alpha()
spack.test.versions.test_formatted_strings()
spack.test.versions.test_get_item()
spack.test.versions.test_in_list()
spack.test.versions.test_intersect_with_containment()
spack.test.versions.test_intersection()
spack.test.versions.test_isdevelop()
spack.test.versions.test_len()
spack.test.versions.test_lists_overlap()
spack.test.versions.test_num_alpha_with_no_separator()
spack.test.versions.test_nums_and_patch()
spack.test.versions.test_overlap_with_containment()
spack.test.versions.test_padded_numbers()
spack.test.versions.test_patch()
spack.test.versions.test_ranges_overlap()
spack.test.versions.test_rc_versions()
spack.test.versions.test_repr_and_str()
spack.test.versions.test_rpm_oddities()
spack.test.versions.test_satisfaction_with_lists()
spack.test.versions.test_string_prefix()
spack.test.versions.test_three_segments()
spack.test.versions.test_two_segments()
spack.test.versions.test_underscores()
spack.test.versions.test_union_with_containment()
spack.test.versions.test_up_to()
spack.test.versions.test_version_range_satisfaction()
spack.test.versions.test_version_range_satisfaction_in_lists()
spack.test.versions.test_version_ranges()

spack.test.views module

spack.test.views.test_global_activation(install_mockery, mock_fetch)

This test ensures that views which are maintained inside of an extendee package's prefix are maintained as expected and are compatible with global activations prior to #7152.

spack.test.web module

Tests for web.py.

spack.test.web.test_find_exotic_versions_of_archive_2()
spack.test.web.test_find_exotic_versions_of_archive_3()
spack.test.web.test_find_versions_of_archive_0()
spack.test.web.test_find_versions_of_archive_1()
spack.test.web.test_find_versions_of_archive_2()
spack.test.web.test_find_versions_of_archive_3()
spack.test.web.test_spider_0()
spack.test.web.test_spider_1()
spack.test.web.test_spider_2()
spack.test.web.test_spider_3()

Module contents