spack.test package

Subpackages

Submodules

spack.test.abi module

Test ABI compatibility helpers

spack.test.abi.test_architecture_compatibility(target, constraint, expected)[source]
spack.test.abi.test_compatibility(target, constraint, loose, expected)[source]
spack.test.abi.test_compiler_compatibility(target, constraint, loose, expected)[source]

spack.test.architecture module

spack.test.architecture.current_host_platform()[source]

Return the platform of the current host as detected by the ‘platform’ stdlib package.

spack.test.architecture.os_str(request)[source]

All the possible strings that can be used for operating systems

spack.test.architecture.target_str(request)[source]

All the possible strings that can be used for targets

spack.test.architecture.test_arch_spec_container_semantic(item, architecture_str)[source]
spack.test.architecture.test_concretize_target_ranges(root_target_range, dep_target_range, result)[source]
spack.test.architecture.test_operating_system_conversion_to_dict()[source]
spack.test.architecture.test_optimization_flags(compiler_spec, target_name, expected_flags, config)[source]
spack.test.architecture.test_optimization_flags_with_custom_versions(compiler, real_version, target_str, expected_flags, monkeypatch, config)[source]
spack.test.architecture.test_platform(current_host_platform)[source]

Check that current host detection return the correct platform

spack.test.architecture.test_satisfy_strict_constraint_when_not_concrete(architecture_tuple, constraint_tuple)[source]
spack.test.architecture.test_target_container_semantic(cpu_flag, target_name)[source]
spack.test.architecture.test_user_input_combination(config, target_str, os_str)[source]

Test for all the valid user input combinations that both the target and the operating system match.

spack.test.audit module

spack.test.audit.test_config_audits(config_section, data, failing_check)[source]
spack.test.audit.test_package_audits(packages, failing_check, mock_packages)[source]

spack.test.bindist module

spack.test.bindist.cache_directory(tmpdir)[source]
spack.test.bindist.config_directory(tmpdir_factory)[source]
spack.test.bindist.default_config(tmpdir_factory, config_directory, monkeypatch, install_mockery_mutable_config)[source]
spack.test.bindist.fake_full_hash(spec)[source]
spack.test.bindist.install_dir_default_layout(tmpdir)[source]

Hooks a fake install directory with a default layout

spack.test.bindist.install_dir_non_default_layout(tmpdir)[source]

Hooks a fake install directory with a non-default layout

spack.test.bindist.mirror_dir(tmpdir_factory)[source]
spack.test.bindist.test_FetchCacheError_only_accepts_lists_of_errors()[source]
spack.test.bindist.test_FetchCacheError_pretty_printing_multiple()[source]
spack.test.bindist.test_FetchCacheError_pretty_printing_single()[source]
spack.test.bindist.test_built_spec_cache(mirror_dir)[source]

Because the buildcache list command fetches the buildcache index and uses it to populate the binary_distribution built spec cache, when this test calls get_mirrors_for_spec, it is testing the popluation of that cache from a buildcache index.

spack.test.bindist.test_default_rpaths_create_install_default_layout(mirror_dir)[source]

Test the creation and installation of buildcaches with default rpaths into the default directory layout scheme.

spack.test.bindist.test_default_rpaths_install_nondefault_layout(mirror_dir)[source]

Test the creation and installation of buildcaches with default rpaths into the non-default directory layout scheme.

spack.test.bindist.test_generate_index_missing(monkeypatch, tmpdir, mutable_config)[source]

Ensure spack buildcache index only reports available packages

spack.test.bindist.test_generate_indices_exception(monkeypatch, capfd)[source]
spack.test.bindist.test_generate_indices_key_error(monkeypatch, capfd)[source]
spack.test.bindist.test_install_legacy_yaml(test_legacy_mirror, install_mockery_mutable_config, mock_packages)[source]
spack.test.bindist.test_legacy_mirror(mutable_config, tmpdir)[source]
spack.test.bindist.test_mirror(mirror_dir)[source]
spack.test.bindist.test_push_and_fetch_keys(mock_gnupghome)[source]
spack.test.bindist.test_relative_rpaths_create_default_layout(mirror_dir)[source]

Test the creation and installation of buildcaches with relative rpaths into the default directory layout scheme.

spack.test.bindist.test_relative_rpaths_install_default_layout(mirror_dir)[source]

Test the creation and installation of buildcaches with relative rpaths into the default directory layout scheme.

spack.test.bindist.test_relative_rpaths_install_nondefault(mirror_dir)[source]

Test the installation of buildcaches with relativized rpaths into the non-default directory layout scheme.

spack.test.bindist.test_spec_needs_rebuild(monkeypatch, tmpdir)[source]

Make sure needs_rebuild properly compares remote full_hash against locally computed one, avoiding unnecessary rebuilds

spack.test.bindist.test_update_index_fix_deps(monkeypatch, tmpdir, mutable_config)[source]

Ensure spack buildcache update-index properly fixes up spec descriptor files on the mirror when updating the buildcache index.

spack.test.bindist.test_update_sbang(tmpdir, test_mirror)[source]

Test the creation and installation of buildcaches with default rpaths into the non-default directory layout scheme, triggering an update of the sbang.

spack.test.bootstrap module

spack.test.bootstrap.active_mock_environment(mutable_config, mutable_mock_env_path)[source]
spack.test.bootstrap.test_bootstrap_deactivates_environments(active_mock_environment)[source]
spack.test.bootstrap.test_bootstrap_disables_modulefile_generation(mutable_config)[source]
spack.test.bootstrap.test_bootstrap_search_for_compilers_with_environment_active(no_compilers_yaml, active_mock_environment)[source]
spack.test.bootstrap.test_bootstrap_search_for_compilers_with_no_environment(no_compilers_yaml)[source]
spack.test.bootstrap.test_config_yaml_is_preserved_during_bootstrap(mutable_config)[source]
spack.test.bootstrap.test_custom_store_in_environment(mutable_config, tmpdir)[source]
spack.test.bootstrap.test_nested_use_of_context_manager(mutable_config)[source]

Test nested use of the context manager

spack.test.bootstrap.test_raising_exception_if_bootstrap_disabled(mutable_config)[source]
spack.test.bootstrap.test_status_function_find_files(mutable_config, mock_executable, tmpdir, monkeypatch, expected_missing)[source]
spack.test.bootstrap.test_store_is_restored_correctly_after_bootstrap(mutable_config, tmpdir)[source]
spack.test.bootstrap.test_store_path_customization(config_value, expected, mutable_config)[source]

spack.test.build_distribution module

spack.test.build_distribution.test_build_tarball_overwrite(install_mockery, mock_fetch, monkeypatch, tmpdir)[source]

spack.test.build_environment module

spack.test.build_environment.build_environment(working_env)[source]
spack.test.build_environment.ensure_env_variables(config, mock_packages, monkeypatch, working_env)[source]

Returns a function that takes a dictionary and updates os.environ for the test lifetime accordingly. Plugs-in mock config and repo.

spack.test.build_environment.test_build_jobs_command_line_overrides()[source]
spack.test.build_environment.test_build_jobs_defaults()[source]
spack.test.build_environment.test_build_jobs_sequential_is_sequential()[source]
spack.test.build_environment.test_cc_not_changed_by_modules(monkeypatch, working_env)[source]
spack.test.build_environment.test_compiler_config_modifications(initial, modifications, expected, ensure_env_variables, monkeypatch)[source]
spack.test.build_environment.test_external_prefixes_last(mutable_config, mock_packages, working_env, monkeypatch)[source]
spack.test.build_environment.test_package_inheritance_module_setup(config, mock_packages, working_env)[source]
spack.test.build_environment.test_parallel_false_is_not_propagating(config, mock_packages)[source]
spack.test.build_environment.test_setting_dtags_based_on_config(config_setting, expected_flag, config, mock_packages)[source]
spack.test.build_environment.test_spack_paths_before_module_paths(config, mock_packages, monkeypatch, working_env)[source]
spack.test.build_environment.test_static_to_shared_library(build_environment)[source]
spack.test.build_environment.test_wrapper_variables(config, mock_packages, working_env, monkeypatch, installation_dir_with_headers)[source]

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

spack.test.build_system_guess module

spack.test.build_system_guess.test_build_systems(url_and_build_system)[source]
spack.test.build_system_guess.url_and_build_system(request, tmpdir)[source]

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[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_autotools_gnuconfig_replacement(mutable_database)[source]

Tests whether only broken config.sub and config.guess are replaced with files from working alternatives from the gnuconfig package.

test_autotools_gnuconfig_replacement_disabled(mutable_database)[source]

Tests whether disabling patch_config_files

test_autotools_gnuconfig_replacement_no_gnuconfig(mutable_database)[source]

Tests whether a useful error message is shown when patch_config_files is enabled, but gnuconfig is not listed as a direct build dependency.

test_broken_external_gnuconfig(mutable_database, tmpdir)[source]

Tests whether we get a useful error message when gnuconfig is marked external, but the install prefix is misconfigured and no config.guess and config.sub substitute files are found in the provided prefix.

test_libtool_archive_files_are_deleted_by_default(mutable_database)[source]
test_libtool_archive_files_might_be_installed_on_demand(mutable_database, monkeypatch)[source]
test_none_is_allowed()[source]
test_with_or_without()[source]
class spack.test.build_systems.TestCMakePackage[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_define()[source]
test_define_from_variant()[source]
class spack.test.build_systems.TestGNUMirrorPackage[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_define()[source]
class spack.test.build_systems.TestSourceforgePackage[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_define()[source]
class spack.test.build_systems.TestSourcewarePackage[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_define()[source]
class spack.test.build_systems.TestXorgPackage[source]

Bases: object

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

Tests that Spack correctly detects targets in a Makefile.

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

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

spack.test.build_systems.test_autotools_args_from_conditional_variant(config, mock_packages)[source]

Test that _activate_or_not returns an empty string when a condition on a variant is not met. When this is the case, the variant is not set in the spec.

spack.test.build_systems.test_cmake_bad_generator(config, mock_packages)[source]
spack.test.build_systems.test_cmake_define_from_variant_conditional(config, mock_packages)[source]

Test that define_from_variant returns empty string when a condition on a variant is not met. When this is the case, the variant is not set in the spec.

spack.test.build_systems.test_cmake_secondary_generator(config, mock_packages)[source]
spack.test.build_systems.test_cmake_std_args(config, mock_packages)[source]
spack.test.build_systems.test_negative_make_check(directory, config, mock_packages, working_env)[source]

Tests that Spack correctly ignores false positives in a Makefile.

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

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

spack.test.buildrequest module

spack.test.buildrequest.test_build_request_basics(install_mockery)[source]
spack.test.buildrequest.test_build_request_errors(install_mockery)[source]
spack.test.buildrequest.test_build_request_strings(install_mockery)[source]

Tests of BuildRequest repr and str for coverage purposes.

spack.test.buildtask module

spack.test.buildtask.test_build_task_basics(install_mockery)[source]
spack.test.buildtask.test_build_task_errors(install_mockery)[source]
spack.test.buildtask.test_build_task_strings(install_mockery)[source]

Tests of build_task repr and str for coverage purposes.

spack.test.cache_fetch module

spack.test.cache_fetch.test_fetch(tmpdir, _fetch_method)[source]

Ensure a fetch after expanding is effectively a no-op.

spack.test.cache_fetch.test_fetch_missing_cache(tmpdir, _fetch_method)[source]

Ensure raise a missing cache file.

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)[source]

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.check_env_var(executable, var, expected)[source]

Check environment variables updated by the passed compiler wrapper

This assumes that cc will print debug output when it’s environment contains SPACK_TEST_COMMAND=dump-env-<variable-to-debug>

spack.test.cc.dump_mode(cc, args)[source]

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(wrapper_environment)[source]
spack.test.cc.test_cc_deps(wrapper_environment)[source]

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

spack.test.cc.test_cc_flags(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_ccache_prepend_for_cc(wrapper_environment)[source]
spack.test.cc.test_ccld_deps(wrapper_environment)[source]

Ensure all flags are added in ccld mode.

spack.test.cc.test_ccld_deps_isystem(wrapper_environment)[source]

Ensure all flags are added in ccld mode. When a build uses -isystem, Spack should inject it’s include paths using -isystem. Spack will insert these after any provided -isystem includes, but before any system directories included using -isystem

spack.test.cc.test_ccld_mode(wrapper_environment)[source]
spack.test.cc.test_ccld_with_system_dirs(wrapper_environment)[source]

Ensure all flags are added in ccld mode.

spack.test.cc.test_ccld_with_system_dirs_isystem(wrapper_environment)[source]

Ensure all flags are added in ccld mode. Ensure that includes are in the proper place when a build uses -isystem, and uses system directories in the include paths

spack.test.cc.test_cpp_flags(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_cpp_mode(wrapper_environment)[source]
spack.test.cc.test_cxx_flags(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_dep_include(wrapper_environment)[source]

Ensure a single dependency include directory is added.

spack.test.cc.test_dep_lib(wrapper_environment)[source]

Ensure a single dependency RPATH is added.

spack.test.cc.test_dep_lib_no_lib(wrapper_environment)[source]

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

spack.test.cc.test_dep_lib_no_rpath(wrapper_environment)[source]

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

spack.test.cc.test_dep_rpath(wrapper_environment)[source]

Ensure RPATHs for root package are added.

spack.test.cc.test_disable_new_dtags(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_fc_flags(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_filter_enable_new_dtags(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_ld_deps(wrapper_environment)[source]

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(wrapper_environment)[source]

Ensure SPACK_LINK_DEPS controls -L for ld.

spack.test.cc.test_ld_deps_partial(wrapper_environment)[source]

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_environment, wrapper_flags)[source]
spack.test.cc.test_ld_mode(wrapper_environment)[source]
spack.test.cc.test_linker_strips_loopopt(wrapper_environment, wrapper_flags)[source]
spack.test.cc.test_no_ccache_prepend_for_fc(wrapper_environment)[source]
spack.test.cc.test_no_wrapper_environment()[source]
spack.test.cc.test_system_path_cleanup(wrapper_environment)[source]

Ensure SPACK_ENV_PATH is removed from PATH, even with trailing /

The compiler wrapper has to ensure that it is not called nested like it would happen when gcc’s collect2 looks in PATH for ld.

To prevent nested calls, the compiler wrapper removes the elements of SPACK_ENV_PATH from PATH. Autotest’s generated testsuite appends a / to each element of PATH when adding AUTOTEST_PATH. Thus, ensure that PATH cleanup works even with trailing /.

spack.test.cc.test_vcheck_mode(wrapper_environment)[source]
spack.test.cc.wrapper_environment()[source]
spack.test.cc.wrapper_flags()[source]

spack.test.ci module

class spack.test.ci.FakeWebResponder(response_code=200, content_to_read=[])[source]

Bases: object

getcode()[source]
open(request)[source]
read(length=None)[source]
spack.test.ci.test_ci_workarounds()[source]
spack.test.ci.test_configure_compilers(mutable_config)[source]
spack.test.ci.test_download_and_extract_artifacts(tmpdir, monkeypatch)[source]
spack.test.ci.test_get_concrete_specs(config, mutable_mock_env_path, mock_packages)[source]
spack.test.ci.test_import_signing_key(mock_gnupghome)[source]
spack.test.ci.test_read_write_cdash_ids(config, tmp_scope, tmpdir, mock_packages)[source]
spack.test.ci.test_register_cdash_build(monkeypatch)[source]
spack.test.ci.test_relate_cdash_builds(config, mutable_mock_env_path, mock_packages, monkeypatch, capfd)[source]
spack.test.ci.test_setup_spack_repro_version(tmpdir, capfd, last_two_git_commits, monkeypatch)[source]
spack.test.ci.test_urlencode_string()[source]
spack.test.ci.tmp_scope()[source]

Creates a temporary configuration scope

spack.test.cmd_extensions module

class spack.test.cmd_extensions.Extension(name, root)[source]

Bases: object

Helper class to simplify the creation of simple command extension directory structures with a conventional format for testing.

add_command(command_name, contents)[source]

Add a command to this command extension.

Parameters
  • command_name (str) – The name of the command.

  • contents (str) – the desired contents of the new command module file.

spack.test.cmd_extensions.extension_creator(tmpdir, config)[source]

Create a basic extension command directory structure

spack.test.cmd_extensions.hello_world_cmd(hello_world_extension)[source]

Create and return an invokable “hello-world” extension command.

spack.test.cmd_extensions.hello_world_extension(extension_creator)[source]

Create an extension with a hello-world command.

spack.test.cmd_extensions.hello_world_with_module_in_root(extension_creator)[source]

Create a “hello-world” extension command with additional code in the root folder.

spack.test.cmd_extensions.test_command_with_import(extension_name, hello_world_with_module_in_root)[source]

Ensure we can write a functioning command with multiple imported subcommands, including where the extension name contains a hyphen.

spack.test.cmd_extensions.test_duplicate_module_load(hello_world_cmd, capsys)[source]

Ensure duplicate module load attempts are successful.

The command module will already have been loaded once by the hello_world_cmd fixture.

spack.test.cmd_extensions.test_extension_naming(extension_path, expected_exception, config)[source]

Ensure that we are correctly validating configured extension paths for conformity with the rules: the basename should match spack-<name>; <name> may have embedded hyphens but not begin with one.

spack.test.cmd_extensions.test_failing_command(command_name, contents, exception, extension_creator)[source]

Ensure that the configured command fails to import with the specified error.

spack.test.cmd_extensions.test_get_command_paths(config)[source]

Exercise the construction of extension command search paths.

spack.test.cmd_extensions.test_missing_command()[source]

Ensure that we raise the expected exception if the desired command is not present.

spack.test.cmd_extensions.test_missing_command_function(extension_creator, capsys)[source]

Ensure we die as expected if a command module does not have the expected command function defined.

Ensure we can find an extension command even if it’s not in the first place we look.

spack.test.cmd_extensions.test_simple_command_extension(hello_world_cmd)[source]

Basic test of a functioning command.

spack.test.concretize module

class spack.test.concretize.TestConcretize[source]

Bases: object

concretize_difficult_packages(a, b)[source]

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

concretize_multi_provider()[source]
pytestmark = [Mark(name='usefixtures', args=('mutable_config', 'mock_packages'), kwargs={})]
test_activating_test_dependencies(spec_str, tests_arg, with_dep, without_dep)[source]
test_adjusting_default_target_based_on_compiler(spec, best_achievable, current_host, mock_targets)[source]
test_all_patches_applied()[source]
test_architecture_deep_inheritance(mock_targets)[source]

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()[source]

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

test_compiler_child()[source]
test_compiler_conflicts_in_package_py(spec_str, expected_str)[source]
test_compiler_constraint_with_external_package(spec_str, expected)[source]
test_compiler_flags_from_user_are_grouped()[source]
test_compiler_in_nonbuildable_external_package(compiler, spec_str, expected, xfailold)[source]

Check that the compiler of a non-buildable external package does not spread to other dependencies, unless no other commpiler is specified.

test_compiler_inheritance(compiler_str)[source]
test_compiler_is_unique(spec_str, expected_compiler)[source]
test_compiler_match_is_preferred_to_newer_version()[source]
test_compiler_version_matches_any_entry_in_compilers_yaml()[source]
test_concrete_specs_are_not_modified_on_reuse(mutable_database, spec_str, expect_installed)[source]
test_concretization_of_test_dependencies()[source]
test_concretize(spec)[source]
test_concretize_anonymous()[source]
test_concretize_anonymous_dep(spec_str)[source]
test_concretize_dependent_with_singlevalued_variant_type()[source]
test_concretize_enable_disable_compiler_existence_check()[source]
test_concretize_mention_build_dep()[source]
test_concretize_preferred_version()[source]
test_concretize_two_virtuals()[source]

Test a package with multiple virtual dependencies.

test_concretize_two_virtuals_with_dual_provider()[source]

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

test_concretize_two_virtuals_with_dual_provider_and_a_conflict()[source]

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_repo)[source]

Test a package with multiple virtual dependencies and one preset.

test_concretize_two_virtuals_with_two_bound()[source]

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

test_concretize_with_provides_when()[source]

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

test_concretize_with_restricted_virtual()[source]
test_conditional_dependencies(spec_str, expected, unexpected)[source]
test_conditional_provides_or_depends_on()[source]
test_conditional_variants(spec_str, expected, unexpected)[source]
test_conditional_variants_fail(bad_spec)[source]
test_conflict_in_all_directives_true()[source]
test_conflicts_in_spec(conflict_spec)[source]
test_conflicts_show_cores(conflict_spec, monkeypatch)[source]
test_cumulative_version_ranges_with_different_length()[source]
test_custom_compiler_version()[source]
test_dependency_conditional_on_another_dependency_state()[source]
test_deprecated_versions_not_selected(spec_str, expected)[source]
test_different_compilers_get_different_flags()[source]
test_dont_select_version_that_brings_more_variants_in()[source]
test_error_message_for_inconsistent_variants(spec_str)[source]
test_external_and_virtual()[source]
test_external_package()[source]
test_external_package_and_compiler_preferences(spec_str, expected)[source]
test_external_package_module()[source]
test_external_package_versions(spec_str, is_external, expected)[source]
test_external_packages_have_consistent_hash()[source]
test_external_that_would_require_a_virtual_dependency()[source]
test_external_with_non_default_variant_as_dependency()[source]
test_find_spec_children()[source]
test_find_spec_none()[source]
test_find_spec_parents()[source]

Tests the spec finding logic used by concretization.

test_find_spec_self()[source]
test_find_spec_sibling()[source]
test_multivalued_variants_from_cli(spec_str, expected_dict)[source]
test_mv_variants_disjoint_sets_from_packages_yaml()[source]
test_mv_variants_disjoint_sets_from_spec(spec_str, variant_name, expected_values)[source]
test_my_dep_depends_on_provider_of_my_virtual_dep()[source]
test_newer_dependency_adds_a_transitive_virtual()[source]
test_no_compilers_for_arch()[source]
test_no_conflict_in_external_specs(spec_str)[source]
test_no_matching_compiler_specs(mock_low_high_config)[source]
test_nobuild_package()[source]

Test that a non-buildable package raise an error if no specs in packages.yaml are compatible with the request.

test_non_default_provider_of_multiple_virtuals()[source]
test_noversion_pkg(spec)[source]

Test concretization failures for no-version packages.

test_os_selection_when_multiple_choices_are_possible(spec_str, expected_os)[source]
test_package_with_constraint_not_met_by_external()[source]

Check that if we have an external package A at version X.Y in packages.yaml, but our spec doesn’t allow X.Y as a version, then a new version of A is built that meets the requirements.

test_patching_dependencies(spec_str, patched_deps)[source]
test_provider_must_meet_requirements()[source]
test_provides_handles_multiple_providers_of_same_version()[source]
test_regression_issue_4492()[source]
test_regression_issue_7239()[source]
test_regression_issue_7705()[source]
test_regression_issue_7941()[source]
test_reuse_installed_packages(context, mutable_database, repo_with_changing_recipe)[source]
test_simultaneous_concretization_of_specs(abstract_specs)[source]
test_target_ranges_in_conflicts()[source]
test_transitive_conditional_virtual_dependency()[source]
test_variant_not_default()[source]
test_version_badness_more_important_than_default_mv_variants()[source]
test_versions_in_virtual_dependencies()[source]
test_virtual_is_fully_expanded_for_callpath()[source]
test_virtual_is_fully_expanded_for_mpileaks()[source]
test_working_around_conflicting_defaults(spec_str, expected)[source]
spack.test.concretize.check_concretize(abstract_spec)[source]
spack.test.concretize.check_spec(abstract, concrete)[source]
spack.test.concretize.current_host(request, monkeypatch)[source]
spack.test.concretize.repo_with_changing_recipe(tmpdir_factory, mutable_mock_repo)[source]
spack.test.concretize.spec(request)[source]

Spec to be concretized

spack.test.concretize_preferences module

class spack.test.concretize_preferences.TestConcretizePreferences[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('concretize_scope', 'mock_packages'), kwargs={})]
test_buildable_false()[source]
test_buildable_false_all()[source]
test_buildable_false_all_true_package()[source]
test_buildable_false_all_true_virtual()[source]
test_buildable_false_virtual()[source]
test_config_permissions_differ_read_write(configure_permissions)[source]
test_config_permissions_from_all(configure_permissions)[source]
test_config_permissions_from_package(configure_permissions)[source]
test_config_perms_fail_write_gt_read(configure_permissions)[source]
test_dependencies_cant_make_version_parent_score_better()[source]

Test that a package can’t select a worse version for a dependent because doing so it can pull-in a dependency that makes the overall version score even or better and maybe has a better score in some lower priority criteria.

test_develop()[source]

Test concretization with develop-like versions

test_external_module(monkeypatch)[source]

Test that packages can find externals specified by module

The specific code for parsing the module is tested elsewhere. This just tests that the preference is accounted for

test_external_mpi()[source]
test_multivalued_variants_are_lower_priority_than_providers()[source]

Test that the rule to maximize the number of values for multivalued variants is considered at lower priority than selecting the default provider for virtual dependencies.

This ensures that we don’t e.g. select openmpi over mpich even if we specified mpich as the default mpi provider, just because openmpi supports more fabrics by default.

test_preferred()[source]

“Test packages with some version marked as preferred=True

test_preferred_compilers()[source]

Test preferred compilers are applied correctly

test_preferred_providers()[source]

Test preferred providers of virtual packages are applied correctly

test_preferred_target(mutable_mock_repo)[source]

Test preferred targets are applied correctly

test_preferred_variants(package_name, variant_value, expected_results)[source]

Test preferred variants are applied correctly

test_preferred_variants_from_wildcard()[source]

Test that ‘foo=*’ concretizes to any value

test_preferred_versions()[source]

Test preferred package versions are applied correctly

test_preferred_versions_mixed_version_types()[source]
test_variant_not_flipped_to_pull_externals()[source]

Test that a package doesn’t prefer pulling in an external to using the default value of a variant.

spack.test.concretize_preferences.assert_variant_values(spec, **variants)[source]
spack.test.concretize_preferences.concretize(abstract_spec)[source]
spack.test.concretize_preferences.concretize_scope(mutable_config, tmpdir)[source]

Adds a scope for concretization preferences

spack.test.concretize_preferences.configure_permissions()[source]
spack.test.concretize_preferences.update_packages(pkgname, section, value)[source]

Update config and reread package list

spack.test.config module

class spack.test.config.MockEnv(path)[source]

Bases: object

spack.test.config.check_compiler_config(comps, *compiler_names)[source]

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

spack.test.config.check_schema(name, file_contents)[source]

Check a Spack YAML schema against some data

spack.test.config.compiler_specs()[source]

Returns a couple of compiler specs needed for the tests

spack.test.config.env_yaml(tmpdir)[source]

Return a sample env.yaml for test purposes

spack.test.config.get_config_error(filename, schema, yaml_string)[source]

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)[source]
spack.test.config.test_add_config_filename(mock_low_high_config, tmpdir)[source]
spack.test.config.test_add_config_path(mutable_config)[source]
spack.test.config.test_add_config_path_with_enumerated_type(mutable_config)[source]
spack.test.config.test_alternate_override(monkeypatch)[source]

Ensure proper scope naming of override when conflict present.

spack.test.config.test_bad_command_line_scopes(tmpdir, mock_low_high_config)[source]
spack.test.config.test_bad_compilers_yaml(tmpdir)[source]
spack.test.config.test_bad_config_section(mock_low_high_config)[source]

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

spack.test.config.test_bad_config_yaml(tmpdir)[source]
spack.test.config.test_bad_env_yaml(tmpdir)[source]
spack.test.config.test_bad_mirrors_yaml(tmpdir)[source]
spack.test.config.test_bad_path_double_override(config)[source]
spack.test.config.test_bad_repos_yaml(tmpdir)[source]
spack.test.config.test_config_format_error(mutable_config)[source]

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

spack.test.config.test_config_parse_dict_in_list(tmpdir)[source]
spack.test.config.test_config_parse_list_in_dict(tmpdir)[source]
spack.test.config.test_config_parse_str_not_bool(tmpdir)[source]
spack.test.config.test_dotkit_in_config_does_not_raise(mock_low_high_config, write_config_file, capsys)[source]
spack.test.config.test_good_env_yaml(tmpdir)[source]
spack.test.config.test_immutable_scope(tmpdir)[source]
spack.test.config.test_internal_config_dict_override(mock_low_high_config, write_config_file)[source]
spack.test.config.test_internal_config_filename(mock_low_high_config, write_config_file)[source]
spack.test.config.test_internal_config_from_data()[source]
spack.test.config.test_internal_config_list_override(mock_low_high_config, write_config_file)[source]
spack.test.config.test_internal_config_scope_cache_clearing()[source]

An InternalConfigScope object is constructed from data that is already in memory, therefore it doesn’t have any cache to clear. Here we ensure that calling the clear method is consistent with that..

spack.test.config.test_internal_config_section_override(mock_low_high_config, write_config_file)[source]
spack.test.config.test_internal_config_update(mock_low_high_config, write_config_file)[source]
spack.test.config.test_keys_are_ordered()[source]

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

spack.test.config.test_list_merge_order()[source]

“Test that source lists are prepended to dest.

spack.test.config.test_local_config_can_be_disabled(working_env)[source]
spack.test.config.test_mark_internal()[source]
spack.test.config.test_merge_with_defaults(mock_low_high_config, write_config_file)[source]

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_nested_override()[source]

Ensure proper scope naming of nested overrides.

spack.test.config.test_ordereddict_merge_order()[source]

“Test that source keys come before dest keys in merge_yaml results.

spack.test.config.test_parse_install_tree(config_settings, expected, mutable_config)[source]
spack.test.config.test_read_config(mock_low_high_config, write_config_file)[source]
spack.test.config.test_read_config_merge_list(mock_low_high_config, write_config_file)[source]
spack.test.config.test_read_config_override_all(mock_low_high_config, write_config_file)[source]
spack.test.config.test_read_config_override_key(mock_low_high_config, write_config_file)[source]
spack.test.config.test_read_config_override_list(mock_low_high_config, write_config_file)[source]
spack.test.config.test_read_with_default(mock_low_high_config)[source]
spack.test.config.test_set_bad_path(config)[source]
spack.test.config.test_set_dict_override(mock_low_high_config, write_config_file)[source]
spack.test.config.test_set_list_override(mock_low_high_config, write_config_file)[source]
spack.test.config.test_set_section_override(mock_low_high_config, write_config_file)[source]
spack.test.config.test_single_file_scope(config, env_yaml)[source]
spack.test.config.test_single_file_scope_cache_clearing(env_yaml)[source]
spack.test.config.test_single_file_scope_section_override(tmpdir, config)[source]

Check that individual config sections can be overridden in an environment config. The config here primarily differs in that the packages section is intended to override all other scopes (using the “::” syntax).

spack.test.config.test_substitute_config_variables(mock_low_high_config, monkeypatch)[source]
spack.test.config.test_substitute_tempdir(mock_low_high_config)[source]
spack.test.config.test_substitute_user(mock_low_high_config)[source]
spack.test.config.test_substitute_user_cache(mock_low_high_config)[source]
spack.test.config.test_system_config_path_is_default_when_env_var_is_empty(working_env)[source]
spack.test.config.test_system_config_path_is_overridable(working_env)[source]
spack.test.config.test_user_cache_path_is_default_when_env_var_is_empty(working_env)[source]
spack.test.config.test_user_cache_path_is_overridable(working_env)[source]
spack.test.config.test_user_config_path_is_default_when_env_var_is_empty(working_env)[source]
spack.test.config.test_user_config_path_is_overridable(working_env)[source]
spack.test.config.test_write_empty_single_file_scope(tmpdir)[source]
spack.test.config.test_write_key_in_memory(mock_low_high_config, compiler_specs)[source]
spack.test.config.test_write_key_to_disk(mock_low_high_config, compiler_specs)[source]
spack.test.config.test_write_list_in_memory(mock_low_high_config)[source]
spack.test.config.test_write_to_same_priority_file(mock_low_high_config, compiler_specs)[source]
spack.test.config.write_config_file(tmpdir)[source]

Returns a function that writes a config file.

spack.test.config_values module

spack.test.config_values.test_set_install_hash_length(hash_length, mutable_config, tmpdir)[source]
spack.test.config_values.test_set_install_hash_length_upper_case(mutable_config, tmpdir)[source]

spack.test.conftest module

class spack.test.conftest.ConfigUpdate(root_for_conf, writer_mod, writer_key, monkeypatch)[source]

Bases: object

class spack.test.conftest.MockBundle[source]

Bases: object

has_code = False
name = 'mock-bundle'
versions = {}
class spack.test.conftest.MockCache[source]

Bases: object

fetcher(target_path, digest, **kwargs)[source]
store(copy_cmd, relative_dest)[source]
class spack.test.conftest.MockCacheFetcher[source]

Bases: object

fetch()[source]
class spack.test.conftest.MockConfig(configuration, writer_key)[source]

Bases: object

configuration(module_set_name)[source]
writer_configuration(module_set_name)[source]
class spack.test.conftest.MockLayout(root)[source]

Bases: object

check_installed(spec)[source]
path_for_spec(spec)[source]
spack.test.conftest.brand_new_binary_cache()[source]
spack.test.conftest.check_for_leftover_stage_files(request, mock_stage, ignore_stage_files)[source]

Ensure that each (mock_stage) test leaves a clean stage when done.

Tests that are expected to dirty the stage can disable the check by adding:

@pytest.mark.disable_clean_stage_check

and the associated stage files will be removed.

spack.test.conftest.clean_test_environment()[source]
spack.test.conftest.clean_user_environment()[source]
spack.test.conftest.clear_directive_functions()[source]

Clear all overidden directive functions for subsequent tests.

spack.test.conftest.clear_recorded_monkeypatches()[source]
spack.test.conftest.config(mock_configuration_scopes)[source]

This fixture activates/deactivates the mock configuration.

spack.test.conftest.configuration_dir(tmpdir_factory, linux_os)[source]

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

spack.test.conftest.conflict_spec(request)[source]

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

spack.test.conftest.database(mock_store, mock_packages, config, monkeypatch)[source]

This activates the mock store, packages, AND config.

spack.test.conftest.default_config()[source]

Isolates the default configuration from the user configs.

This ensures we can test the real default configuration without having tests fail when the user overrides the defaults that we test against.

spack.test.conftest.dirs_with_libfiles(tmpdir_factory)[source]
spack.test.conftest.disable_compiler_execution(monkeypatch, request)[source]

This fixture can be disabled for tests of the compiler link path functionality by:

@pytest.mark.enable_compiler_link_paths

If a test is marked in that way this is a no-op.

spack.test.conftest.gen_mock_layout(tmpdir)[source]
spack.test.conftest.ignore_stage_files()[source]

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(temporary_store, config, mock_packages)[source]

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

spack.test.conftest.install_mockery_mutable_config(temporary_store, mutable_config, mock_packages)[source]

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

This is specifically for tests which want to use ‘install_mockery’ but also need to modify configuration (and hence would want to use ‘mutable config’): ‘install_mockery’ does not support this.

spack.test.conftest.installation_dir_with_headers(tmpdir_factory)[source]

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)[source]

Specs that do not parse cleanly due to invalid formatting.

spack.test.conftest.last_two_git_commits(scope='session')[source]
spack.test.conftest.linux_os()[source]

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

spack.test.conftest.mock_archive(request, tmpdir_factory)[source]

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_binary_index(monkeypatch, tmpdir_factory)[source]

Changes the directory for the binary index and creates binary index for every test. Clears its own index when it’s done.

spack.test.conftest.mock_compiler_executable_verification(request, monkeypatch)[source]

Mock the compiler executable verification to allow missing executables.

This fixture can be disabled for tests of the compiler verification functionality by:

@pytest.mark.enable_compiler_verification

If a test is marked in that way this is a no-op.

spack.test.conftest.mock_configuration_scopes(configuration_dir)[source]

Create a persistent Configuration object from the configuration_dir.

spack.test.conftest.mock_cvs_repository(tmpdir_factory)[source]

Creates a very simple CVS repository with two commits and a branch.

spack.test.conftest.mock_directive_bundle()[source]

Return a mock bundle package for directive tests.

spack.test.conftest.mock_executable(tmpdir)[source]

Factory to create a mock executable in a temporary directory that output a custom string when run.

spack.test.conftest.mock_fetch(mock_archive, monkeypatch)[source]

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

spack.test.conftest.mock_fetch_cache(monkeypatch)[source]

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

spack.test.conftest.mock_git_repository(tmpdir_factory)[source]

Creates a simple git repository with two branches, two commits and two submodules. Each submodule has one commit.

spack.test.conftest.mock_git_version_info(tmpdir, scope='function')[source]

Create a mock git repo with known structure

The structure of commits in this repo is as follows:

| o fourth 1.x commit (1.2)
| o third 1.x commit
| |
o | fourth main commit (v2.0)
o | third main commit
| |
| o second 1.x commit (v1.1)
| o first 1.x commit
| /
|/
o second commit (v1.0)
o first commit

The repo consists of a single file, in which the Version._cmp representation of each commit is expressed as a string.

Important attributes of the repo for test coverage are: multiple branches, version tags on multiple branches, and version order is not equal to time order or topological order.

spack.test.conftest.mock_gnupghome(monkeypatch)[source]
spack.test.conftest.mock_hg_repository(tmpdir_factory)[source]

Creates a very simple hg repository with two commits.

spack.test.conftest.mock_low_high_config(tmpdir)[source]

Mocks two configuration scopes: ‘low’ and ‘high’.

spack.test.conftest.mock_packages(mock_repo_path, mock_pkg_install)[source]

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

spack.test.conftest.mock_pkg_install(monkeypatch)[source]
spack.test.conftest.mock_repo_path()[source]
spack.test.conftest.mock_stage(tmpdir_factory, monkeypatch, request)[source]

Establish the temporary build_stage for the mock archive.

spack.test.conftest.mock_store(tmpdir_factory, mock_repo_path, mock_configuration_scopes, _store_dir_and_cache)[source]

Creates a read-only mock database with some packages installed note that the ref count for dyninst here will be 3, as it’s recycled across each install.

This does not actually activate the store for use by Spack – see the database fixture for that.

spack.test.conftest.mock_svn_repository(tmpdir_factory)[source]

Creates a very simple svn repository with two commits.

spack.test.conftest.mock_targets(mock_uarch_configuration, monkeypatch)[source]

Use this fixture to enable mock uarch targets for testing.

spack.test.conftest.mock_test_repo(tmpdir_factory)[source]

Create an empty repository.

spack.test.conftest.mock_test_stage(mutable_config, tmpdir)[source]
spack.test.conftest.mock_uarch_configuration(mock_uarch_json)[source]

Create mock dictionaries for the archspec.cpu.

spack.test.conftest.mock_uarch_json(tmpdir_factory)[source]

Mock microarchitectures.json with test architecture descriptions.

spack.test.conftest.module_configuration(monkeypatch, request)[source]

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)[source]

Like config, but tests can modify the configuration.

spack.test.conftest.mutable_database(database, _store_dir_and_cache)[source]

Writeable version of the fixture, restored to its initial state after each test.

spack.test.conftest.mutable_empty_config(tmpdir_factory, configuration_dir)[source]

Empty configuration that can be modified by the tests.

spack.test.conftest.mutable_mock_env_path(tmpdir_factory)[source]

Fixture for mocking the internal spack environments directory.

spack.test.conftest.mutable_mock_repo(mock_repo_path)[source]

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

spack.test.conftest.no_chdir()[source]

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.no_compilers_yaml(mutable_config)[source]

Creates a temporary configuration without compilers.yaml

spack.test.conftest.no_path_access(monkeypatch)[source]
spack.test.conftest.pytest_addoption(parser)[source]
spack.test.conftest.pytest_collection_modifyitems(config, items)[source]
spack.test.conftest.record_monkeypatch_setattr()[source]
spack.test.conftest.remove_whatever_it_is(path)[source]

Type-agnostic remove.

spack.test.conftest.reset_compiler_cache()[source]

Ensure that the compiler cache is not shared across Spack tests

This cache can cause later tests to fail if left in a state incompatible with the new configuration. Since tests can make almost unlimited changes to their setup, default to not use the compiler cache across tests.

spack.test.conftest.temporary_store(tmpdir)[source]

Hooks a temporary empty store for the test function.

spack.test.conftest.test_platform()[source]
spack.test.conftest.working_env()[source]
spack.test.conftest.write_file(filename, contents)[source]

spack.test.cvs_fetch module

spack.test.cvs_fetch.test_cvs_extra_fetch(tmpdir)[source]

Ensure a fetch after downloading is effectively a no-op.

spack.test.cvs_fetch.test_fetch(type_of_test, mock_cvs_repository, config, mutable_mock_repo)[source]

Tries to:

  1. Fetch the repo using a fetch strategy constructed with supplied args (they depend on type_of_test).

  2. Check whether the checkout is on the correct branch or date

  3. Check if the test_file is in the checked out repository.

  4. Add and remove some files, then reset the repo, and ensure it’s all there again.

CVS does not have the notion of a unique branch; branches and revisions are managed separately for every file.

spack.test.database module

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

class spack.test.database.ReadModify[source]

Bases: object

Provide a function which can execute in a separate process that removes a spec from the database.

spack.test.database.test_005_db_exists(database)[source]

Make sure db cache file exists after creating.

spack.test.database.test_010_all_install_sanity(database)[source]

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

spack.test.database.test_015_write_and_read(mutable_database)[source]
spack.test.database.test_017_write_and_read_without_uuid(mutable_database, monkeypatch)[source]
spack.test.database.test_020_db_sanity(database)[source]

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

spack.test.database.test_025_reindex(mutable_database)[source]

Make sure reindex works and ref counts are valid.

spack.test.database.test_026_reindex_after_deprecate(mutable_database)[source]

Make sure reindex works and ref counts are valid after deprecation.

spack.test.database.test_030_db_sanity_from_another_process(mutable_database)[source]
spack.test.database.test_040_ref_counts(database)[source]

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

spack.test.database.test_041_ref_counts_deprecate(mutable_database)[source]

Ensure that we have appropriate ref counts after deprecating

spack.test.database.test_050_basic_query(database)[source]

Ensure querying database is consistent with what is installed.

spack.test.database.test_060_remove_and_add_root_package(mutable_database)[source]
spack.test.database.test_070_remove_and_add_dependency_package(mutable_database)[source]
spack.test.database.test_080_root_ref_counts(mutable_database)[source]
spack.test.database.test_090_non_root_ref_counts(mutable_database)[source]
spack.test.database.test_100_no_write_with_exception_on_remove(database)[source]
spack.test.database.test_110_no_write_with_exception_on_install(database)[source]
spack.test.database.test_115_reindex_with_packages_not_in_repo(mutable_database)[source]
spack.test.database.test_add_to_upstream_after_downstream(upstream_and_downstream_db)[source]

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_cannot_write_upstream(tmpdir_factory, gen_mock_layout)[source]
spack.test.database.test_clear_failure_forced(mutable_database, monkeypatch, capfd)[source]

Add test coverage for clear_failure operation when force.

spack.test.database.test_clear_failure_keep(mutable_database, monkeypatch, capfd)[source]

Add test coverage for clear_failure operation when to be retained.

spack.test.database.test_database_works_with_empty_dir(tmpdir)[source]
spack.test.database.test_default_queries(database)[source]
spack.test.database.test_external_entries_in_db(mutable_database)[source]
spack.test.database.test_failed_spec_path_error(database)[source]

Ensure spec not concrete check is covered.

spack.test.database.test_installed_upstream(upstream_and_downstream_db)[source]
spack.test.database.test_mark_failed(mutable_database, monkeypatch, tmpdir, capsys)[source]

Add coverage to mark_failed.

spack.test.database.test_old_external_entries_prefix(mutable_database)[source]
spack.test.database.test_prefix_failed(mutable_database, monkeypatch)[source]

Add coverage to prefix_failed operation.

spack.test.database.test_prefix_read_lock_error(mutable_database, monkeypatch)[source]

Cover the prefix read lock exception.

spack.test.database.test_prefix_write_lock_error(mutable_database, monkeypatch)[source]

Cover the prefix write lock exception.

spack.test.database.test_query_spec_with_conditional_dependency(mutable_database)[source]
spack.test.database.test_query_spec_with_non_conditional_virtual_dependency(database)[source]
spack.test.database.test_query_unused_specs(mutable_database)[source]
spack.test.database.test_recursive_upstream_dbs(tmpdir_factory, gen_mock_layout)[source]
spack.test.database.test_regression_issue_8036(mutable_database, usr_folder_exists)[source]
spack.test.database.test_removed_upstream_dep(upstream_and_downstream_db)[source]
spack.test.database.test_store_find_accept_string(database)[source]
spack.test.database.test_store_find_failures(database, query_arg, exc_type, msg_str)[source]
spack.test.database.test_uninstall_by_spec(mutable_database)[source]
spack.test.database.upstream_and_downstream_db(tmpdir_factory, gen_mock_layout)[source]
spack.test.database.usr_folder_exists(monkeypatch)[source]

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

spack.test.directives.test_constraints_from_context(mock_packages)[source]
spack.test.directives.test_constraints_from_context_are_merged(mock_packages)[source]
spack.test.directives.test_extends_spec(config, mock_packages)[source]
spack.test.directives.test_false_directives_do_not_exist(mock_packages)[source]

Ensure directives that evaluate to False at import time are added to dicts on packages.

spack.test.directives.test_true_directives_exist(mock_packages)[source]

Ensure directives that evaluate to True at import time are added to dicts on packages.

spack.test.directory_layout module

This test verifies that the Spack directory layout works properly.

spack.test.directory_layout.test_find(temporary_store, config, mock_packages)[source]

Test that finding specs within an install layout works.

spack.test.directory_layout.test_handle_unknown_package(temporary_store, config, mock_packages)[source]

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(temporary_store, config, mock_packages)[source]

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_build_path(tmpdir, config)[source]

This tests build path method.

spack.test.directory_layout.test_yaml_directory_layout_parameters(tmpdir, config)[source]

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

spack.test.env module

Test environment internals without CLI

spack.test.env.test_activate_should_require_an_env()[source]
spack.test.env.test_hash_change_no_rehash_concrete(tmpdir, mock_packages, config)[source]

spack.test.environment module

spack.test.environment.test_environment_pickle(tmpdir)[source]

spack.test.environment_modifications module

spack.test.environment_modifications.env(prepare_environment_for_tests)[source]

Returns an empty EnvironmentModifications object.

spack.test.environment_modifications.files_to_be_sourced()[source]

Returns a list of files to be sourced

spack.test.environment_modifications.miscellaneous_paths()[source]

Returns a list of paths, including system ones.

spack.test.environment_modifications.prepare_environment_for_tests(working_env)[source]

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)[source]

Tests appending to a value in the environment.

spack.test.environment_modifications.test_blacklist_lmod_variables()[source]
spack.test.environment_modifications.test_clear(env)[source]
spack.test.environment_modifications.test_environment_from_sourcing_files(files, expected, deleted)[source]
spack.test.environment_modifications.test_exclude_paths_from_inspection()[source]
spack.test.environment_modifications.test_extend(env)[source]

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

spack.test.environment_modifications.test_extra_arguments(env)[source]

Tests that we can attach extra arguments to any command.

spack.test.environment_modifications.test_filter_system_paths(miscellaneous_paths)[source]

Tests that the filtering of system paths works as expected.

spack.test.environment_modifications.test_from_environment_diff(before, after, search_list)[source]
spack.test.environment_modifications.test_inspect_path(tmpdir)[source]
spack.test.environment_modifications.test_path_manipulation(env)[source]

Tests manipulating list of paths in the environment.

spack.test.environment_modifications.test_preserve_environment(prepare_environment_for_tests)[source]
spack.test.environment_modifications.test_sanitize_literals(env, blacklist, whitelist)[source]
spack.test.environment_modifications.test_sanitize_regex(env, blacklist, whitelist, expected, deleted)[source]
spack.test.environment_modifications.test_set(env)[source]

Tests setting values in the environment.

spack.test.environment_modifications.test_set_path(env)[source]

Tests setting paths in an environment variable.

spack.test.environment_modifications.test_source_files(files_to_be_sourced)[source]

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

spack.test.environment_modifications.test_unset(env)[source]

Tests unsetting values in the environment.

spack.test.fetch_strategy module

spack.test.fetch_strategy.test_fetchstrategy_bad_url_scheme()[source]

Ensure that trying to make a fetch strategy from a URL with an unsupported scheme fails as expected.

spack.test.flag_handlers module

class spack.test.flag_handlers.TestFlagHandlers[source]

Bases: object

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

spack.test.gcs_fetch module

spack.test.gcs_fetch.test_gcsfetchstrategy_bad_url(tmpdir, _fetch_method)[source]

Ensure fetch with bad URL fails as expected.

spack.test.gcs_fetch.test_gcsfetchstrategy_downloaded(tmpdir, _fetch_method)[source]

Ensure fetch with archive file already downloaded is a noop.

spack.test.gcs_fetch.test_gcsfetchstrategy_without_url(_fetch_method)[source]

Ensure constructor with no URL fails.

spack.test.git_fetch module

spack.test.git_fetch.git_version(request, monkeypatch)[source]

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.mock_bad_git(monkeypatch)[source]

Test GitFetchStrategy behavior with a bad git command for git >= 1.7.1 to trigger a SpackError.

spack.test.git_fetch.test_bad_git(tmpdir, mock_bad_git)[source]

Trigger a SpackError when attempt a fetch with a bad git.

spack.test.git_fetch.test_debug_fetch(mock_packages, type_of_test, mock_git_repository, config)[source]

Fetch the repo with debug enabled.

spack.test.git_fetch.test_fetch(type_of_test, secure, mock_git_repository, config, mutable_mock_repo, git_version)[source]

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.test_get_full_repo(get_full_repo, git_version, mock_git_repository, config, mutable_mock_repo)[source]

Ensure that we can clone a full repository.

spack.test.git_fetch.test_git_extra_fetch(tmpdir)[source]

Ensure a fetch after ‘expanding’ is effectively a no-op.

spack.test.git_fetch.test_gitsubmodule(submodules, mock_git_repository, config, mutable_mock_repo)[source]

Test GitFetchStrategy behavior with submodules

spack.test.git_fetch.test_gitsubmodules_delete(mock_git_repository, config, mutable_mock_repo)[source]

Test GitFetchStrategy behavior with submodules_delete

spack.test.git_fetch.test_needs_stage()[source]

Trigger a NoStageError when attempt a fetch without a stage.

spack.test.graph module

spack.test.graph.test_ascii_graph_mpileaks(mock_packages)[source]

Test dynamically graphing the mpileaks package.

spack.test.graph.test_dynamic_dot_graph_mpileaks(mock_packages, config)[source]

Test dynamically graphing the mpileaks package.

spack.test.graph.test_static_graph_mpileaks(mock_packages)[source]

Test a static spack graph for a simple package.

spack.test.graph.test_topo_sort(mock_packages)[source]

Test topo sort gives correct order.

spack.test.graph.test_topo_sort_filtered(mock_packages)[source]

Test topo sort gives correct order when filtering link deps.

spack.test.hg_fetch module

spack.test.hg_fetch.test_fetch(type_of_test, secure, mock_hg_repository, config, mutable_mock_repo)[source]

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.test_hg_extra_fetch(tmpdir)[source]

Ensure a fetch after expanding is effectively a no-op.

spack.test.install module

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

Bases: spack.error.SpackError

class spack.test.install.MockStage(wrapped_stage)[source]

Bases: object

create()[source]
destroy()[source]
class spack.test.install.RemovePrefixChecker(wrapped_rm_prefix)[source]

Bases: object

remove_prefix()[source]
spack.test.install.find_nothing(*args)[source]
spack.test.install.install_upstream(tmpdir_factory, gen_mock_layout, install_mockery)[source]

Provides a function that installs a specified set of specs to an upstream database. The function returns a store which points to the upstream, as well as the upstream layout (for verifying that dependent installs are using the upstream installs).

spack.test.install.mock_remove_prefix(*args)[source]
spack.test.install.test_dont_add_patches_to_installed_package(install_mockery, mock_fetch)[source]
spack.test.install.test_failing_build(install_mockery, mock_fetch, capfd)[source]
spack.test.install.test_failing_overwrite_install_should_keep_previous_installation(mock_fetch, install_mockery)[source]

Make sure that whenever spack install –overwrite fails, spack restores the original install prefix instead of cleaning it.

spack.test.install.test_flatten_deps(install_mockery, mock_fetch, mutable_mock_repo)[source]

Explicitly test the flattening code for coverage purposes.

spack.test.install.test_install_and_uninstall(install_mockery, mock_fetch, monkeypatch)[source]

Test dependency flattening/symlinks mock package.

spack.test.install.test_install_error()[source]
spack.test.install.test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdir)[source]

Test that different specs with coinciding install prefixes will fail to install.

spack.test.install.test_install_times(install_mockery, mock_fetch, mutable_mock_repo)[source]

Test install times added.

spack.test.install.test_installed_dependency_request_conflicts(install_mockery, mock_fetch, mutable_mock_repo)[source]
spack.test.install.test_installed_upstream(install_upstream, mock_fetch)[source]

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(install_upstream, mock_fetch)[source]

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

spack.test.install.test_log_install_with_build_files(install_mockery, monkeypatch)[source]

Test the installer’s log function when have build files.

spack.test.install.test_log_install_without_build_files(install_mockery)[source]

Test the installer log function when no build files are present.

spack.test.install.test_nosource_pkg_install(install_mockery, mock_fetch, mock_packages, capfd)[source]

Test install phases with the nosource package.

spack.test.install.test_nosource_pkg_install_post_install(install_mockery, mock_fetch, mock_packages)[source]

Test install phases with the nosource package with post-install.

spack.test.install.test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch)[source]
spack.test.install.test_partial_install_keep_prefix(install_mockery, mock_fetch)[source]
spack.test.install.test_pkg_build_paths(install_mockery)[source]
spack.test.install.test_pkg_install_paths(install_mockery)[source]
spack.test.install.test_second_install_no_overwrite_first(install_mockery, mock_fetch)[source]
spack.test.install.test_store(install_mockery, mock_fetch)[source]
spack.test.install.test_unconcretized_install(install_mockery, mock_fetch, mock_packages)[source]

Test attempts to perform install phases with unconcretized spec.

spack.test.install.test_uninstall_by_spec_errors(mutable_database)[source]

Test exceptional cases with the uninstall command.

spack.test.installer module

spack.test.installer.create_build_task(pkg, install_args={})[source]

Create a built task for the given (concretized) package

Parameters
  • pkg (spack.package.PackageBase) – concretized package associated with the task

  • install_args (dict) – dictionary of kwargs (or install args)

Returns

(BuildTask) A basic package build task

spack.test.installer.create_installer(installer_args)[source]

Create an installer using the concretized spec for each arg

Parameters

installer_args (list) – the list of (spec name, kwargs) tuples

Returns

the associated package installer

Return type

spack.installer.PackageInstaller

spack.test.installer.installer_args(spec_names, kwargs={})[source]

Return a the installer argument with each spec paired with kwargs

Parameters
  • spec_names (list) – list of spec names

  • kwargs (dict or None) – install arguments to apply to all of the specs

Returns

list of (spec, kwargs), the installer constructor argument

Return type

list

spack.test.installer.test_add_bootstrap_compilers(install_mockery, monkeypatch)[source]
spack.test.installer.test_check_before_phase_error(install_mockery)[source]
spack.test.installer.test_check_deps_status_external(install_mockery, monkeypatch)[source]
spack.test.installer.test_check_deps_status_install_failure(install_mockery, monkeypatch)[source]
spack.test.installer.test_check_deps_status_upstream(install_mockery, monkeypatch)[source]
spack.test.installer.test_check_deps_status_write_locked(install_mockery, monkeypatch)[source]
spack.test.installer.test_check_last_phase_error(install_mockery)[source]
spack.test.installer.test_cleanup_all_tasks(install_mockery, monkeypatch)[source]

Test to ensure cover _cleanup_all_tasks.

spack.test.installer.test_cleanup_failed_err(install_mockery, tmpdir, monkeypatch, capsys)[source]

Test _cleanup_failed exception path.

spack.test.installer.test_clear_failures_errs(install_mockery, monkeypatch, capsys)[source]

Test the clear_failures exception paths.

spack.test.installer.test_clear_failures_success(install_mockery)[source]

Test the clear_failures happy path.

spack.test.installer.test_combine_phase_logs(tmpdir)[source]

Write temporary files, and assert that combine phase logs works to combine them into one file. We aren’t currently using this function, but it’s available when the logs are refactored to be written separately.

spack.test.installer.test_dump_packages_deps_errs(install_mockery, tmpdir, monkeypatch, capsys)[source]

Test error paths for dump_packages with dependencies.

spack.test.installer.test_dump_packages_deps_ok(install_mockery, tmpdir, mock_packages)[source]

Test happy path for dump_packages with dependencies.

spack.test.installer.test_ensure_locked_err(install_mockery, monkeypatch, tmpdir, capsys)[source]

Test _ensure_locked when a non-lock exception is raised.

spack.test.installer.test_ensure_locked_have(install_mockery, tmpdir, capsys)[source]

Test _ensure_locked when already have lock.

spack.test.installer.test_ensure_locked_new_lock(install_mockery, tmpdir, lock_type, reads, writes)[source]
spack.test.installer.test_ensure_locked_new_warn(install_mockery, monkeypatch, tmpdir, capsys)[source]
spack.test.installer.test_fake_install(install_mockery)[source]
spack.test.installer.test_get_dependent_ids(install_mockery, mock_packages)[source]
spack.test.installer.test_hms(sec, result)[source]
spack.test.installer.test_install_fail_fast_on_detect(install_mockery, monkeypatch, capsys)[source]

Test fail_fast install when an install failure is detected.

spack.test.installer.test_install_fail_fast_on_except(install_mockery, monkeypatch, capsys)[source]

Test fail_fast install when an install failure results from an error.

spack.test.installer.test_install_fail_multi(install_mockery, monkeypatch)[source]

Test expected results for failure of multiple packages.

spack.test.installer.test_install_fail_on_interrupt(install_mockery, monkeypatch)[source]

Test ctrl-c interrupted install.

spack.test.installer.test_install_fail_single(install_mockery, monkeypatch)[source]

Test expected results for failure of single package.

spack.test.installer.test_install_failed(install_mockery, monkeypatch, capsys)[source]

Test install with failed install.

spack.test.installer.test_install_failed_not_fast(install_mockery, monkeypatch, capsys)[source]

Test install with failed install.

spack.test.installer.test_install_from_cache_errors(install_mockery, capsys)[source]

Test to ensure cover _install_from_cache errors.

spack.test.installer.test_install_from_cache_ok(install_mockery, monkeypatch)[source]

Test to ensure cover _install_from_cache to the return.

spack.test.installer.test_install_lock_failures(install_mockery, monkeypatch, capfd)[source]

Cover basic install lock failure handling in a single pass.

spack.test.installer.test_install_lock_installed_requeue(install_mockery, monkeypatch, capfd)[source]

Cover basic install handling for installed package.

spack.test.installer.test_install_msg(monkeypatch)[source]

Test results of call to install_msg based on debug level.

spack.test.installer.test_install_read_locked_requeue(install_mockery, monkeypatch, capfd)[source]

Cover basic read lock handling for uninstalled package with requeue.

spack.test.installer.test_install_skip_patch(install_mockery, mock_fetch)[source]

Test the path skip_patch install path.

spack.test.installer.test_install_task_add_compiler(install_mockery, monkeypatch, capfd)[source]
spack.test.installer.test_install_task_use_cache(install_mockery, monkeypatch)[source]
spack.test.installer.test_install_uninstalled_deps(install_mockery, monkeypatch, capsys)[source]

Test install with uninstalled dependencies.

spack.test.installer.test_installer_ensure_ready_errors(install_mockery)[source]
spack.test.installer.test_installer_init_requests(install_mockery)[source]

Test of installer initial requests.

spack.test.installer.test_installer_repr(install_mockery)[source]
spack.test.installer.test_installer_str(install_mockery)[source]
spack.test.installer.test_overwrite_install_backup_failure(temporary_store, config, mock_packages, tmpdir)[source]

When doing an overwrite install that fails, Spack should try to recover the original prefix. If that fails, the spec is lost, and it should be removed from the database.

spack.test.installer.test_overwrite_install_backup_success(temporary_store, config, mock_packages, tmpdir)[source]

When doing an overwrite install that fails, Spack should restore the backup of the original prefix, and leave the original spec marked installed.

spack.test.installer.test_package_id_err(install_mockery)[source]
spack.test.installer.test_package_id_ok(install_mockery)[source]
spack.test.installer.test_packages_needed_to_bootstrap_compiler_none(install_mockery)[source]
spack.test.installer.test_packages_needed_to_bootstrap_compiler_packages(install_mockery, monkeypatch)[source]
spack.test.installer.test_prepare_for_install_on_installed(install_mockery, monkeypatch)[source]

Test of _prepare_for_install’s early return for installed task path.

spack.test.installer.test_process_binary_cache_tarball_none(install_mockery, monkeypatch, capfd)[source]

Tests of _process_binary_cache_tarball when no tarball.

spack.test.installer.test_process_binary_cache_tarball_tar(install_mockery, monkeypatch, capfd)[source]

Tests of _process_binary_cache_tarball with a tar file.

spack.test.installer.test_process_external_package_module(install_mockery, monkeypatch, capfd)[source]

Test to simply cover the external module message path.

spack.test.installer.test_push_task_skip_processed(install_mockery, installed)[source]

Test to ensure skip re-queueing a processed package.

spack.test.installer.test_release_lock_write_n_exception(install_mockery, tmpdir, capsys)[source]

Test _release_lock for supposed write lock with exception.

spack.test.installer.test_requeue_task(install_mockery, capfd)[source]

Test to ensure cover _requeue_task.

spack.test.installer.test_setup_install_dir_grp(install_mockery, monkeypatch, capfd)[source]

Test _setup_install_dir’s group change.

spack.test.installer.test_try_install_from_binary_cache(install_mockery, mock_packages, monkeypatch)[source]

Tests SystemExit path for_try_install_from_binary_cache.

This test does not make sense. We tell spack there is a mirror with a binary for this spec and then expect it to die because there are no mirrors configured.

spack.test.installer.test_update_failed_no_dependent_task(install_mockery)[source]

Test _update_failed with missing dependent build tasks.

spack.test.main module

spack.test.main.test_get_version_bad_git(tmpdir, working_env)[source]
spack.test.main.test_get_version_match_git(tmpdir, working_env)[source]
spack.test.main.test_get_version_no_git(tmpdir, working_env)[source]
spack.test.main.test_get_version_no_match_git(tmpdir, working_env)[source]
spack.test.main.test_get_version_no_repo(tmpdir, monkeypatch)[source]
spack.test.main.test_main_calls_get_version(tmpdir, capsys, working_env)[source]

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')[source]

Bases: unittest.case.TestCase

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_make_explicit()[source]
test_make_jobs_env()[source]
test_make_normal()[source]
test_make_one_job()[source]
test_make_parallel_disabled()[source]
test_make_parallel_false()[source]
test_make_parallel_precedence()[source]

spack.test.mirror module

class spack.test.mirror.MockFetcher[source]

Bases: object

Mock fetcher object which implements the necessary functionality for testing MirrorCache

static archive(dst)[source]
spack.test.mirror.check_mirror()[source]
spack.test.mirror.set_up_package(name, repository, url_attr)[source]

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)[source]
spack.test.mirror.test_git_mirror(mock_git_repository)[source]
spack.test.mirror.test_hg_mirror(mock_hg_repository)[source]
spack.test.mirror.test_mirror_archive_paths_no_version(mock_packages, config, mock_archive)[source]

Confirm that the cosmetic symlink created in the mirror cache (which may be relative) targets the storage path correctly.

spack.test.mirror.test_mirror_with_url_patches(mock_packages, config, monkeypatch)[source]
spack.test.mirror.test_svn_mirror(mock_svn_repository)[source]
spack.test.mirror.test_url_mirror(mock_archive)[source]

spack.test.module_parsing module

spack.test.module_parsing.test_get_argument_from_module_line()[source]
spack.test.module_parsing.test_get_path_from_empty_module()[source]
spack.test.module_parsing.test_get_path_from_module_contents()[source]
spack.test.module_parsing.test_get_path_from_module_faked(monkeypatch)[source]
spack.test.module_parsing.test_lmod_quote_parsing()[source]
spack.test.module_parsing.test_module_function_change_env(tmpdir, working_env, monkeypatch)[source]
spack.test.module_parsing.test_module_function_no_change(tmpdir, monkeypatch)[source]
spack.test.module_parsing.test_pkg_dir_from_module_name()[source]

spack.test.monitor module

spack.test.monitor.get_client(host, prefix='ms1', allow_fail=False, tags=None, save_local=False)[source]

We replicate this function to not generate a global client.

spack.test.monitor.mock_monitor_request(monkeypatch)[source]

Monitor requests that are shared across tests go here

spack.test.monitor.test_install_monitor_save_local(install_mockery_mutable_config, mock_fetch, tmpdir_factory)[source]

Mock installing and saving monitor results to file.

spack.test.monitor.test_spack_monitor_auth(mock_monitor_request)[source]
spack.test.monitor.test_spack_monitor_basic_auth(mock_monitor_request)[source]
spack.test.monitor.test_spack_monitor_build_env(mock_monitor_request, install_mockery_mutable_config)[source]
spack.test.monitor.test_spack_monitor_fail_task(mock_monitor_request, install_mockery, install_mockery_mutable_config)[source]
spack.test.monitor.test_spack_monitor_info(mock_monitor_request)[source]
spack.test.monitor.test_spack_monitor_new_build(mock_monitor_request, install_mockery_mutable_config, install_mockery)[source]
spack.test.monitor.test_spack_monitor_new_configuration(mock_monitor_request, install_mockery)[source]
spack.test.monitor.test_spack_monitor_send_analyze_metadata(monkeypatch, mock_monitor_request, install_mockery, install_mockery_mutable_config)[source]
spack.test.monitor.test_spack_monitor_send_phase(mock_monitor_request, install_mockery, install_mockery_mutable_config)[source]
spack.test.monitor.test_spack_monitor_update_build(mock_monitor_request, install_mockery, install_mockery_mutable_config)[source]
spack.test.monitor.test_spack_monitor_without_auth(mock_monitor_request)[source]

spack.test.multimethod module

Test for multi_method dispatch.

spack.test.multimethod.pkg_name(request)[source]

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)[source]
spack.test.multimethod.test_dependency_match(pkg_name)[source]
spack.test.multimethod.test_mpi_version(pkg_name)[source]
spack.test.multimethod.test_multimethod_boolean(pkg_name)[source]
spack.test.multimethod.test_multimethod_diamond_inheritance()[source]
spack.test.multimethod.test_multimethod_inherited_and_overridden()[source]
spack.test.multimethod.test_multimethod_with_base_class(pkg_name)[source]
spack.test.multimethod.test_no_version_match(pkg_name)[source]
spack.test.multimethod.test_one_version_match(pkg_name)[source]
spack.test.multimethod.test_target_match(pkg_name)[source]
spack.test.multimethod.test_undefined_mpi_version(pkg_name)[source]
spack.test.multimethod.test_version_overlap(pkg_name)[source]
spack.test.multimethod.test_virtual_dep_match(pkg_name)[source]

spack.test.namespace_trie module

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

spack.test.operating_system module

spack.test.operating_system.test_cle_release_precedence(tmpdir, monkeypatch)[source]

test that cle-release file takes precedence over clerelease file.

spack.test.operating_system.test_read_cle_release_file(tmpdir, monkeypatch)[source]

test reading the Cray cle-release file

spack.test.operating_system.test_read_clerelease_file(tmpdir, monkeypatch)[source]

test reading the Cray clerelease file

spack.test.optional_deps module

spack.test.optional_deps.spec_and_expected(request)[source]

Parameters for the normalization test.

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

spack.test.package_class module

Test class methods on Package objects.

This doesn’t include methods on package instances (like do_install(), etc.). Only methods like possible_dependencies() that deal with the static DSL metadata for packages.

spack.test.package_class.mpi_names(mock_repo_path)[source]
spack.test.package_class.mpileaks_possible_deps(mock_packages, mpi_names)[source]
spack.test.package_class.setup_install_test(source_paths, install_test_root)[source]

Set up the install test by creating sources and install test roots.

The convention used here is to create an empty file if the path name ends with an extension otherwise, a directory is created.

spack.test.package_class.test_cache_extra_sources(install_mockery, spec, sources, extras, expect)[source]

Test the package’s cache extra test sources helper function.

spack.test.package_class.test_possible_dependencies(mock_packages, mpileaks_possible_deps)[source]
spack.test.package_class.test_possible_dependencies_missing(mock_packages)[source]
spack.test.package_class.test_possible_dependencies_virtual(mock_packages, mpi_names)[source]
spack.test.package_class.test_possible_dependencies_with_deptypes(mock_packages)[source]
spack.test.package_class.test_possible_dependencies_with_multiple_classes(mock_packages, mpileaks_possible_deps)[source]
spack.test.package_class.test_possible_direct_dependencies(mock_packages, mpileaks_possible_deps)[source]

spack.test.package_sanity module

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

spack.test.package_sanity.check_repo()[source]

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

spack.test.package_sanity.test_all_dependencies_exist()[source]

Make sure no packages have nonexisting dependencies.

spack.test.package_sanity.test_all_packages_use_sha256_checksums()[source]

Make sure that no packages use md5 checksums.

spack.test.package_sanity.test_all_versions_are_lowercase()[source]

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

spack.test.package_sanity.test_all_virtual_packages_have_default_providers()[source]

All virtual packages must have a default provider explicitly set.

spack.test.package_sanity.test_api_for_build_and_run_environment()[source]

Ensure that every package uses the correct API to set build and run environment, and not the old one.

spack.test.package_sanity.test_docstring()[source]

Ensure that every package has a docstring.

spack.test.package_sanity.test_get_all_mock_packages()[source]

Get the mock packages once each too.

spack.test.package_sanity.test_get_all_packages()[source]

Get all packages once and make sure that works.

spack.test.package_sanity.test_no_fixme()[source]

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

spack.test.package_sanity.test_package_version_consistency()[source]

Make sure all versions on builtin packages produce a fetcher.

spack.test.package_sanity.test_packages_are_pickleable()[source]
spack.test.package_sanity.test_packages_are_unparseable()[source]

Ensure that all packages can unparse and that unparsed code is valid Python.

spack.test.package_sanity.test_prs_update_old_api()[source]

Ensures that every package modified in a PR doesn’t contain deprecated calls to any method.

spack.test.package_sanity.test_repo_getpkg_names_and_classes()[source]

Ensure that all_packages/names/classes are consistent.

spack.test.package_sanity.test_variant_defaults_are_parsable_from_cli()[source]

Ensures that variant defaults are parsable from cli.

spack.test.package_sanity.test_variant_defaults_listed_explicitly_in_values()[source]

spack.test.packages module

class spack.test.packages.TestPackage[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('config', 'mock_packages'), kwargs={})]
test_dependency_extensions()[source]
test_import_class_from_package()[source]
test_import_module_from_package()[source]
test_import_namespace_container_modules()[source]
test_import_package()[source]
test_import_package_as()[source]
test_inheritance_of_diretives()[source]
test_inheritance_of_patches()[source]
test_load_package()[source]
test_nonexisting_package_filename()[source]
test_package_class_names()[source]
test_package_filename()[source]
test_package_name()[source]
spack.test.packages.test_bundle_patch_directive(mock_directive_bundle, clear_directive_functions)[source]

Test raising exception on a patch directive with a bundle package.

spack.test.packages.test_bundle_version_checksum(mock_directive_bundle, clear_directive_functions)[source]

Test raising exception on a version checksum with a bundle package.

spack.test.packages.test_fetch_options(mock_packages, config)[source]

Test fetch options inference.

spack.test.packages.test_git_top_level(mock_packages, config)[source]

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

spack.test.packages.test_git_url_top_level_conflicts(mock_packages, config)[source]

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

spack.test.packages.test_git_url_top_level_git_versions(mock_packages, config)[source]

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

spack.test.packages.test_git_url_top_level_url_versions(mock_packages, config)[source]

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

spack.test.packages.test_hg_top_level(mock_packages, config)[source]

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

spack.test.packages.test_no_extrapolate_without_url(mock_packages, config)[source]

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

spack.test.packages.test_rpath_args(mutable_database)[source]

Test a package’s rpath_args property.

spack.test.packages.test_svn_top_level(mock_packages, config)[source]

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

spack.test.packages.test_two_vcs_fetchers_top_level(mock_packages, config)[source]

Verify conflict when two VCS strategies are specified together.

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

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)[source]

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

spack.test.packaging.fetching_not_allowed(monkeypatch)[source]
spack.test.packaging.mock_download()[source]

Mock a failing download strategy.

spack.test.packaging.test_buildcache(mock_archive, tmpdir)[source]
spack.test.packaging.test_fetch_external_package_is_noop(install_mockery, fetching_not_allowed)[source]

do_fetch for packages without code should be a no-op

spack.test.packaging.test_fetch_without_code_is_noop(install_mockery, fetching_not_allowed)[source]

do_fetch for packages without code should be a no-op

spack.test.packaging.test_macho_make_paths()[source]
spack.test.packaging.test_manual_download(install_mockery, mock_download, monkeypatch, manual, instr)[source]

Ensure expected fetcher fail message based on manual download and instr.

spack.test.packaging.test_needs_relocation()[source]
spack.test.packaging.test_relocate_text(tmpdir)[source]
spack.test.packaging.test_replace_paths(tmpdir)[source]

spack.test.patch module

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

Validate patches on dependencies of patch-several-dependencies.

spack.test.patch.mock_patch_stage(tmpdir_factory, monkeypatch)[source]
spack.test.patch.test_conditional_patched_dependencies(mock_packages, config)[source]

Test whether conditional patched dependencies work.

spack.test.patch.test_conditional_patched_deps_with_conditions(mock_packages, config)[source]

Test whether conditional patched dependencies with conditions work.

spack.test.patch.test_invalid_level(level)[source]
spack.test.patch.test_multiple_patched_dependencies(mock_packages, config)[source]

Test whether multiple patched dependencies work.

spack.test.patch.test_nested_directives(mock_packages)[source]

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

spack.test.patch.test_patch_in_spec(mock_packages, config)[source]

Test whether patches in a package appear in the spec.

spack.test.patch.test_patch_mixed_versions_subset_constraint(mock_packages, config)[source]

If we have a package with mixed x.y and x.y.z versions, make sure that a patch applied to a version range of x.y.z versions is not applied to an x.y version.

spack.test.patch.test_patch_no_file()[source]
spack.test.patch.test_patch_order(mock_packages, config)[source]
spack.test.patch.test_patched_dependency(mock_packages, config, install_mockery, mock_fetch)[source]

Test whether patched dependencies work.

spack.test.patch.test_url_patch(mock_patch_stage, filename, sha256, archive_sha256)[source]
spack.test.patch.test_write_and_read_sub_dags_with_patched_deps(mock_packages, config)[source]

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)[source]

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

spack.test.pattern.implementation(interface)[source]

Returns an implementation of the interface

spack.test.pattern.interface()[source]

Returns the interface class for the composite.

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

spack.test.permissions module

spack.test.permissions.test_chmod_real_entries_ignores_suid_sgid(tmpdir)[source]
spack.test.permissions.test_chmod_rejects_group_writable_suid(tmpdir)[source]
spack.test.permissions.test_chmod_rejects_world_writable_sgid(tmpdir)[source]
spack.test.permissions.test_chmod_rejects_world_writable_suid(tmpdir)[source]

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

spack.test.relocate module

spack.test.relocate.copy_binary()[source]

Returns a function that copies a binary somewhere and returns the new location.

spack.test.relocate.hello_world(tmpdir)[source]

Factory fixture that compiles an ELF binary setting its RPATH. Relative paths are encoded with $ORIGIN prepended.

spack.test.relocate.is_relocatable(request)[source]
spack.test.relocate.make_dylib(tmpdir_factory)[source]

Create a shared library with unfriendly qualities.

  • Writes the same rpath twice

  • Writes its install path as an absolute path

spack.test.relocate.make_object_file(tmpdir)[source]
spack.test.relocate.mock_patchelf(tmpdir, mock_executable)[source]
spack.test.relocate.rpaths_for(new_binary)[source]

Return the RPATHs or RUNPATHs of a binary.

spack.test.relocate.skip_unless_linux(f)[source]
spack.test.relocate.source_file(tmpdir, is_relocatable)[source]

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

spack.test.relocate.test_existing_rpaths(patchelf_behavior, expected, mock_patchelf)[source]
spack.test.relocate.test_file_is_relocatable(source_file, is_relocatable)[source]
spack.test.relocate.test_file_is_relocatable_errors(tmpdir)[source]
spack.test.relocate.test_fixup_macos_rpaths(make_dylib, make_object_file)[source]
spack.test.relocate.test_make_elf_binaries_relative(hello_world, copy_binary, tmpdir)[source]
spack.test.relocate.test_make_relative_paths(start_path, path_root, paths, expected)[source]
spack.test.relocate.test_normalize_relative_paths(start_path, relative_paths, expected)[source]
spack.test.relocate.test_patchelf_is_relocatable()[source]
spack.test.relocate.test_raise_if_not_relocatable(monkeypatch)[source]
spack.test.relocate.test_relocate_elf_binaries_absolute_paths(hello_world, copy_binary, tmpdir)[source]
spack.test.relocate.test_relocate_elf_binaries_relative_paths(hello_world, copy_binary)[source]
spack.test.relocate.test_relocate_text_bin(hello_world, copy_binary, tmpdir)[source]
spack.test.relocate.test_relocate_text_bin_raise_if_new_prefix_is_longer(tmpdir)[source]
spack.test.relocate.test_replace_prefix_bin(hello_world)[source]
spack.test.relocate.test_set_elf_rpaths(mock_patchelf)[source]
spack.test.relocate.test_set_elf_rpaths_warning(mock_patchelf)[source]
spack.test.relocate.text_in_bin(text, binary)[source]

spack.test.repo module

spack.test.repo.extra_repo(tmpdir_factory)[source]
spack.test.repo.test_all_package_names_is_cached_correctly()[source]
spack.test.repo.test_namespace_hasattr(attr_name, exists, mutable_mock_repo)[source]
spack.test.repo.test_repo_anonymous_pkg(mutable_mock_repo)[source]
spack.test.repo.test_repo_getpkg(mutable_mock_repo)[source]
spack.test.repo.test_repo_invisibles(mutable_mock_repo, extra_repo)[source]
spack.test.repo.test_repo_last_mtime()[source]
spack.test.repo.test_repo_multi_getpkg(mutable_mock_repo, extra_repo)[source]
spack.test.repo.test_repo_multi_getpkgclass(mutable_mock_repo, extra_repo)[source]
spack.test.repo.test_repo_pkg_with_unknown_namespace(mutable_mock_repo)[source]
spack.test.repo.test_repo_unknown_pkg(mutable_mock_repo)[source]

spack.test.s3_fetch module

spack.test.s3_fetch.test_s3fetchstrategy_bad_url(tmpdir, _fetch_method)[source]

Ensure fetch with bad URL fails as expected.

spack.test.s3_fetch.test_s3fetchstrategy_downloaded(tmpdir, _fetch_method)[source]

Ensure fetch with archive file already downloaded is a noop.

spack.test.s3_fetch.test_s3fetchstrategy_sans_url(_fetch_method)[source]

Ensure constructor with no URL fails.

spack.test.sbang module

Test that Spack’s shebang filtering works correctly.

class spack.test.sbang.ScriptDirectory(sbang_line)[source]

Bases: object

Directory full of test scripts to run sbang instrumentation on.

destroy()[source]
make_executable(path)[source]
spack.test.sbang.check_sbang_installation(group=False)[source]
spack.test.sbang.configure_group_perms()[source]
spack.test.sbang.configure_user_perms()[source]
spack.test.sbang.run_test_install_sbang(group)[source]
spack.test.sbang.sbang_line()[source]
spack.test.sbang.script_dir(sbang_line)[source]
spack.test.sbang.shebang_limits_system_8_spack_16()[source]
spack.test.sbang.test_install_group_sbang(install_mockery, configure_group_perms)[source]
spack.test.sbang.test_install_sbang_too_long(tmpdir)[source]
spack.test.sbang.test_install_user_sbang(install_mockery, configure_user_perms)[source]
spack.test.sbang.test_sbang_handles_non_utf8_files(tmpdir)[source]
spack.test.sbang.test_sbang_hook_handles_non_writable_files_preserving_permissions(tmpdir)[source]
spack.test.sbang.test_sbang_hook_skips_nonexecutable_blobs(tmpdir)[source]
spack.test.sbang.test_shebang_exceeds_spack_shebang_limit(shebang_limits_system_8_spack_16, tmpdir)[source]

Tests whether shebangs longer than Spack’s limit are skipped

spack.test.sbang.test_shebang_handles_non_writable_files(script_dir, sbang_line)[source]
spack.test.sbang.test_shebang_handling(script_dir, sbang_line)[source]
spack.test.sbang.test_shebang_interpreter_regex(shebang, interpreter)[source]

spack.test.schema module

spack.test.schema.meta_schema()[source]

Meta schema for JSON schema validation (Draft 4)

spack.test.schema.module_suffixes_schema()[source]
spack.test.schema.test_deprecated_properties(module_suffixes_schema)[source]
spack.test.schema.test_module_suffixes(module_suffixes_schema)[source]
spack.test.schema.test_schema_validation(meta_schema, config_name)[source]
spack.test.schema.test_validate_spec(validate_spec_schema)[source]
spack.test.schema.validate_spec_schema()[source]

spack.test.spack_yaml module

Test Spack’s custom YAML format.

spack.test.spack_yaml.data()[source]

Returns the data loaded from a test file

spack.test.spack_yaml.test_dict_order(data)[source]
spack.test.spack_yaml.test_line_numbers(data)[source]
spack.test.spack_yaml.test_parse(data)[source]
spack.test.spack_yaml.test_yaml_aliases()[source]

spack.test.spec_dag module

These tests check Spec DAG operations using dummy packages.

class spack.test.spec_dag.TestSpecDag[source]

Bases: object

check_diamond_deptypes(spec)[source]

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)[source]
pytestmark = [Mark(name='usefixtures', args=('mutable_mock_repo', 'config'), kwargs={})]
test_canonical_deptype()[source]
test_concretize_deptypes()[source]

Ensure that dependency types are preserved after concretization.

test_conflicting_package_constraints(set_dependency)[source]
test_conflicting_spec_constraints()[source]
test_construct_spec_with_deptypes()[source]

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

test_contains()[source]
test_copy_concretized()[source]
test_copy_dependencies()[source]
test_copy_deptypes()[source]

Ensure that dependency types are preserved by spec copy.

test_copy_normalized()[source]
test_copy_simple()[source]
test_dependents_and_dependencies_are_correct()[source]
test_deptype_traversal()[source]
test_deptype_traversal_full()[source]
test_deptype_traversal_run()[source]
test_deptype_traversal_with_builddeps()[source]
test_edge_traversals()[source]

Make sure child and parent traversals of specs work.

test_equal()[source]
test_getitem_exceptional_paths()[source]
test_getitem_query()[source]
test_hash_bits()[source]

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

test_invalid_dep(spec_str)[source]
test_invalid_literal_spec()[source]
test_normalize_a_lot()[source]
test_normalize_diamond_deptypes()[source]

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

test_normalize_mpileaks()[source]
test_normalize_twice()[source]

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

test_normalize_with_virtual_package()[source]
test_normalize_with_virtual_spec()[source]
test_postorder_edge_traversal()[source]
test_postorder_node_traversal()[source]
test_postorder_path_traversal()[source]
test_preorder_edge_traversal()[source]
test_preorder_node_traversal()[source]
test_preorder_path_traversal()[source]
test_traversal_directions()[source]

Make sure child and parent traversals of specs work.

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

Returns a dictionary to save the dependencies.

spack.test.spec_dag.set_dependency(saved_deps)[source]

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(spec_str, expr_str, expected)[source]

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_installed_deps()[source]

Preinstall a package P with a constrained build dependency D, then concretize a dependent package which also depends on P and D, specifying that the installed instance of P should be used. In this case, D should not be constrained by P since P is already built.

spack.test.spec_dag.test_specify_preinstalled_dep()[source]

Specify the use of a preinstalled package during concretization with a transitive dependency that is only supplied by the preinstalled package.

spack.test.spec_dag.test_test_deptype()[source]

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

class spack.test.spec_list.TestSpecList[source]

Bases: object

default_constraints = [[mpileaks], [zmpi@1.0], [mpich@3.0], [hypre, %gcc@4.5.0], [hypre, %clang@3.3], [libelf]]
default_expansion = ['mpileaks', 'zmpi@1.0', 'mpich@3.0', {'matrix': [['hypre'], ['%gcc@4.5.0', '%clang@3.3']]}, 'libelf']
default_input = ['mpileaks', '$mpis', {'matrix': [['hypre'], ['$gccs', '$clangs']]}, 'libelf']
default_reference = {'clangs': <spack.spec_list.SpecList object>, 'gccs': <spack.spec_list.SpecList object>, 'mpis': <spack.spec_list.SpecList object>}
default_specs = [mpileaks, zmpi@1.0, mpich@3.0, hypre%gcc@4.5.0, hypre%clang@3.3, libelf]
test_spec_list_add()[source]
test_spec_list_constraint_ordering()[source]
test_spec_list_expansions()[source]
test_spec_list_extension()[source]
test_spec_list_matrix_exclude(mock_packages)[source]
test_spec_list_nested_matrices()[source]
test_spec_list_recursion_specs_as_constraints()[source]
test_spec_list_remove()[source]
test_spec_list_update_reference()[source]

spack.test.spec_semantics module

class spack.test.spec_semantics.TestSpecSematics[source]

Bases: 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()[source]
test_combination_of_wildcard_or_none()[source]
test_constrain_architecture()[source]
test_constrain_changed()[source]
test_constrain_compiler()[source]
test_constrain_compiler_flags()[source]
test_constrain_dependency_changed()[source]
test_constrain_dependency_not_changed()[source]
test_constrain_multi_value_variant()[source]
test_constrain_not_changed()[source]
test_constrain_variants()[source]
test_copy_satisfies_transitive()[source]
test_dep_index()[source]
test_empty_satisfies()[source]
test_error_message_unknown_variant()[source]
test_errors_in_variant_directive()[source]
test_exceptional_paths_for_constructor()[source]
test_forwarding_of_architecture_attributes()[source]
test_indirect_unsatisfied_single_valued_variant()[source]
test_invalid_constraint()[source]
test_satisfies()[source]
test_satisfies_architecture()[source]
test_satisfies_compiler()[source]
test_satisfies_compiler_version()[source]
test_satisfies_dependencies()[source]
test_satisfies_dependencies_ordered()[source]
test_satisfies_dependency_versions()[source]
test_satisfies_matching_compiler_flag()[source]
test_satisfies_matching_variant()[source]
test_satisfies_multi_value_variant()[source]
test_satisfies_namespace()[source]
test_satisfies_namespaced_dep()[source]

Ensure spec from same or unspecified namespace satisfies namespace constraint.

test_satisfies_same_spec_with_different_hash()[source]

Ensure that concrete specs are matched exactly by hash.

test_satisfies_single_valued_variant()[source]

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

test_satisfies_unconstrained_compiler_flag()[source]
test_satisfies_unconstrained_variant()[source]
test_satisfies_virtual()[source]
test_satisfies_virtual_dep_with_virtual_constraint()[source]

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

test_satisfies_virtual_dependencies()[source]
test_satisfies_virtual_dependency_versions()[source]
test_self_index()[source]
test_spec_contains_deps()[source]
test_spec_deprecated_formatting()[source]
test_spec_flags_maintain_order()[source]
test_spec_formatting()[source]
test_spec_formatting_escapes()[source]
test_splice(transitive)[source]
test_splice_dict(transitive)[source]
test_splice_dict_roundtrip(transitive)[source]
test_splice_input_unchanged(transitive)[source]
test_splice_subsequent(transitive)[source]
test_splice_with_cached_hashes(transitive)[source]
test_target_constraints(spec, constraint, expected_result)[source]
test_unsatisfiable_compiler_flag()[source]
test_unsatisfiable_compiler_flag_mismatch()[source]
test_unsatisfiable_multi_value_variant()[source]
test_unsatisfiable_variant_mismatch()[source]
test_unsatisfiable_variant_types()[source]
test_unsatisfiable_variants()[source]
test_unsatisfied_single_valued_variant()[source]
test_virtual_index()[source]
spack.test.spec_semantics.check_constrain(expected, spec, constraint)[source]
spack.test.spec_semantics.check_constrain_changed(spec, constraint)[source]
spack.test.spec_semantics.check_constrain_not_changed(spec, constraint)[source]
spack.test.spec_semantics.check_invalid_constraint(spec, constraint)[source]
spack.test.spec_semantics.check_satisfies(target_spec, constraint_spec, target_concrete=False)[source]
spack.test.spec_semantics.check_unsatisfiable(target_spec, constraint_spec, target_concrete=False)[source]
spack.test.spec_semantics.make_spec(spec_like, concrete)[source]
spack.test.spec_semantics.test_is_extension_after_round_trip_to_dict(config, spec_str)[source]
spack.test.spec_semantics.test_malformed_spec_dict()[source]
spack.test.spec_semantics.test_merge_abstract_anonymous_specs(specs, expected)[source]
spack.test.spec_semantics.test_spec_dict_hashless_dep()[source]

spack.test.spec_syntax module

class spack.test.spec_syntax.TestSpecSyntax[source]

Bases: object

check_lex(tokens, spec)[source]

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

check_parse(expected, spec=None)[source]

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()[source]
test_ambiguous_hash(mutable_database)[source]
test_anonymous_specs()[source]
test_anonymous_specs_with_multiple_parts()[source]
test_canonicalize()[source]
test_compare_abstract_specs()[source]

Spec comparisons must be valid for abstract specs.

Check that the spec cmp_key appropriately handles comparing specs for which some attributes are None in exactly one of two specs

test_dep_spec_by_hash(database)[source]
test_dependencies_with_versions()[source]
test_duplicate_architecture()[source]
test_duplicate_architecture_component()[source]
test_duplicate_compiler()[source]
test_duplicate_dependency()[source]
test_duplicate_variant()[source]
test_full_specs()[source]
test_invalid_hash(database)[source]
test_kv_with_quotes()[source]
test_kv_with_spaces()[source]
test_kv_without_quotes()[source]
test_minimal_spaces()[source]
test_multiple_specs()[source]
test_multiple_specs_after_kv()[source]
test_multiple_specs_long_second()[source]
test_multiple_specs_with_hash(database)[source]
test_multiple_versions()[source]
test_nice_error_for_no_space_after_spec_filename()[source]

Ensure that omitted spaces don’t give weird errors about hashes.

test_nonexistent_hash(database)[source]

Ensure we get errors for nonexistant hashes.

test_package_names()[source]
test_parse_errors()[source]
test_parse_filename_missing_slash_as_spec(mock_packages, tmpdir)[source]

Ensure that libelf.yaml parses as a spec, NOT a file.

test_parse_yaml_dependency(mock_packages, tmpdir)[source]
test_parse_yaml_dependency_relative_paths(mock_packages, tmpdir)[source]
test_parse_yaml_error_handling()[source]
test_parse_yaml_relative_paths(mock_packages, tmpdir)[source]
test_parse_yaml_relative_subdir_path(mock_packages, tmpdir)[source]
test_parse_yaml_simple(mock_packages, tmpdir)[source]
test_parse_yaml_variant_error(mock_packages, tmpdir)[source]
test_redundant_spec(database)[source]

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()[source]
test_spaces_between_dependences()[source]
test_spaces_between_options()[source]
test_spec_by_hash(database)[source]
test_target_tokenization(expected_tokens, spec_string)[source]
test_version_after_compiler()[source]
test_way_too_many_spaces()[source]
test_yaml_spec_not_filename(mock_packages, tmpdir)[source]
test_yaml_specs()[source]

spack.test.spec_yaml module

Test YAML serialization for specs.

YAML format preserves DAG information in the spec.

spack.test.spec_yaml.check_json_round_trip(spec)[source]
spack.test.spec_yaml.check_specs_equal(original_spec, spec_yaml_path)[source]
spack.test.spec_yaml.check_yaml_round_trip(spec)[source]
spack.test.spec_yaml.reverse_all_dicts(data)[source]

Descend into data and reverse all the dictionaries

spack.test.spec_yaml.test_ambiguous_version_spec(mock_packages)[source]
spack.test.spec_yaml.test_concrete_spec(config, mock_packages)[source]
spack.test.spec_yaml.test_external_spec(config, mock_packages)[source]
spack.test.spec_yaml.test_hashes_use_no_python_dicts(module)[source]

Coarse check to make sure we don’t use dicts in Spec.to_node_dict().

Python dicts are not guaranteed to iterate in a deterministic order (at least not in all python versions) so we need to use lists and syaml_dicts. syaml_dicts are ordered and ensure that hashes in Spack are deterministic.

This test is intended to handle cases that are not covered by the consistency checks above, or that would be missed by a dynamic check. This test traverses the ASTs of functions that are used in our hash algorithms, finds instances of dictionaries being constructed, and prints out the line numbers where they occur.

spack.test.spec_yaml.test_legacy_yaml(tmpdir, install_mockery, mock_packages)[source]

Tests a simple legacy YAML with a dependency and ensures spec survives concretization.

spack.test.spec_yaml.test_normal_spec(mock_packages)[source]
spack.test.spec_yaml.test_ordered_read_not_required_for_consistent_dag_hash(hash_type, config, mock_packages)[source]

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

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

spack.test.stage module

Test that the Stage class works correctly.

class spack.test.stage.TestStage[source]

Bases: object

pytestmark = [Mark(name='usefixtures', args=('mock_packages',), kwargs={})]
stage_name = 'spack-test-stage'
test_composite_stage_with_expand_resource(composite_stage_with_expanding_resource)[source]
test_composite_stage_with_expand_resource_default_placement(composite_stage_with_expanding_resource)[source]

For a resource which refers to a compressed archive which expands to a directory, check that by default the resource is placed in the source_path of the root stage with the name of the decompressed directory.

test_composite_stage_with_noexpand_resource(mock_stage_archive, mock_noexpand_resource)[source]
test_create_stage_root(tmpdir, no_path_access)[source]

Test create_stage_root permissions.

test_create_stage_root_bad_uid(tmpdir, monkeypatch)[source]

Test the code path that uses an existing user path – whether $user in $tempdir or not – and triggers the generation of the UID mismatch warning.

This situation can happen with some config:build_stage settings for teams using a common service account for installing software.

test_diystage_path_invalid()[source]

Ensure DIYStage for an invalid path behaves as expected.

test_diystage_path_none()[source]

Ensure DIYStage for path=None behaves as expected.

test_diystage_path_valid(tmpdir)[source]

Ensure DIYStage for a valid path behaves as expected.

test_diystage_preserve_file(tmpdir)[source]

Ensure DIYStage preserves an existing file.

test_ensure_one_stage_entry(mock_stage_archive)[source]
test_expand_archive(expected_file_list, mock_stage_archive)[source]
test_expand_archive_extra_expand(mock_stage_archive)[source]

Test expand with an extra expand after expand (i.e., no-op).

test_fetch(mock_stage_archive, debug)[source]
test_first_accessible_path(tmpdir)[source]

Test _first_accessible_path names.

test_get_stage_root_bad_path(clear_stage_root)[source]

Ensure an invalid stage path root raises a StageError.

test_keep_exceptions(mock_stage_archive)[source]
test_keep_without_exceptions(mock_stage_archive)[source]
test_no_keep_with_exceptions(mock_stage_archive)[source]
test_no_keep_without_exceptions(mock_stage_archive)[source]
test_no_search_if_default_succeeds(mock_stage_archive, failing_search_fn)[source]
test_no_search_mirror_only(failing_fetch_strategy, failing_search_fn)[source]
test_noexpand_stage_file(mock_stage_archive, mock_noexpand_resource)[source]

When creating a stage with a nonexpanding URL, the ‘archive_file’ property of the stage should refer to the path of that file.

test_resolve_paths()[source]

Test _resolve_paths.

test_restage(mock_stage_archive)[source]
test_search_if_default_fails(failing_fetch_strategy, search_fn, err_msg, expected)[source]
test_setup_and_destroy_name_with_tmp(mock_stage_archive)[source]
test_setup_and_destroy_name_without_tmp(mock_stage_archive)[source]
test_setup_and_destroy_no_name_with_tmp(mock_stage_archive)[source]
test_setup_and_destroy_no_name_without_tmp(mock_stage_archive)[source]
test_source_path_available(mock_stage_archive)[source]

Ensure source path available but does not exist on instantiation.

test_stage_constructor_no_fetcher()[source]

Ensure Stage constructor with no URL or fetch strategy fails.

test_stage_constructor_with_path(tmpdir)[source]

Ensure Stage constructor with a path uses it.

test_stage_purge(tmpdir, clear_stage_root, path, purged)[source]

Test purging of stage directories.

spack.test.stage.check_destroy(stage, stage_name)[source]

Figure out whether a stage was destroyed correctly.

spack.test.stage.check_expand_archive(stage, stage_name, expected_file_list)[source]

Ensure the expanded archive directory contains the expected structure and files as described in the module-level comments above.

spack.test.stage.check_fetch(stage, stage_name)[source]

Ensure the fetch resulted in a properly placed archive file as described in the module-level comments.

spack.test.stage.check_setup(stage, stage_name, archive)[source]

Figure out whether a stage was set up correctly.

spack.test.stage.check_stage_dir_perms(prefix, path)[source]

Check the stage directory perms to ensure match expectations.

spack.test.stage.clear_stage_root(monkeypatch)[source]

Ensure spack.stage._stage_root is not set at test start.

spack.test.stage.composite_stage_with_expanding_resource(mock_stage_archive, mock_expand_resource)[source]

Sets up a composite for expanding resources prior to staging.

spack.test.stage.failing_fetch_strategy()[source]

Returns a fetch strategy that fails.

spack.test.stage.failing_search_fn()[source]

Returns a search function that fails! Always!

spack.test.stage.get_stage_path(stage, stage_name)[source]

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

spack.test.stage.mock_expand_resource(tmpdir)[source]

Sets up an expandable resource in tmpdir prior to staging.

spack.test.stage.mock_noexpand_resource(tmpdir)[source]

Set up a non-expandable resource in the tmpdir prior to staging.

spack.test.stage.mock_stage_archive(tmp_build_stage_dir)[source]

Create the directories and files for the staged mock archive.

spack.test.stage.search_fn()[source]

Returns a search function that always succeeds.

spack.test.stage.test_cannot_access(capsys)[source]

Ensure can_access dies with the expected error.

spack.test.stage.test_stage_create_replace_path(tmp_build_stage_dir)[source]

Ensure stage creation replaces a non-directory path.

spack.test.stage.tmp_build_stage_dir(tmpdir, clear_stage_root)[source]

Use a temporary test directory for the stage root.

spack.test.svn_fetch module

spack.test.svn_fetch.test_fetch(type_of_test, secure, mock_svn_repository, config, mutable_mock_repo)[source]

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.test_svn_extra_fetch(tmpdir)[source]

Ensure a fetch after downloading is effectively a no-op.

spack.test.tag module

Tests for tag index cache files.

spack.test.tag.ensure_tags_results_equal(results, expected)[source]
spack.test.tag.test_tag_copy(mock_packages)[source]
spack.test.tag.test_tag_equal()[source]
spack.test.tag.test_tag_get_all_available(mock_packages)[source]
spack.test.tag.test_tag_get_available(tags, expected, mock_packages)[source]
spack.test.tag.test_tag_get_installed_packages(mock_packages, mock_archive, mock_fetch, install_mockery)[source]
spack.test.tag.test_tag_index_round_trip(mock_packages)[source]
spack.test.tag.test_tag_merge()[source]
spack.test.tag.test_tag_no_tags()[source]
spack.test.tag.test_tag_not_dict()[source]
spack.test.tag.test_tag_update_package(mock_packages)[source]

spack.test.tengine module

class spack.test.tengine.TestContext[source]

Bases: object

class A[source]

Bases: spack.tengine.Context

context_properties = ['foo']
property foo
class B[source]

Bases: spack.tengine.Context

property bar
context_properties = ['bar']
class C[source]

Bases: spack.test.tengine.TestContext.A, spack.test.tengine.TestContext.B

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

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

class spack.test.tengine.TestTengineEnvironment[source]

Bases: object

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

Tests the template retrieval mechanism hooked into config files

spack.test.test_activations module

This includes tests for customized activation logic for specific packages (e.g. python and perl).

spack.test.test_activations.builtin_and_mock_packages()[source]
spack.test.test_activations.create_dir_structure(tmpdir, dir_structure)[source]
spack.test.test_activations.create_ext_pkg(name, prefix, extendee_spec, monkeypatch)[source]
spack.test.test_activations.create_python_ext_pkg(name, prefix, python_spec, monkeypatch, namespace=None)[source]