spack.test.util package

Submodules

spack.test.util.compression module

spack.test.util.compression.archive_file(tmpdir_factory, request)[source]

Copy example archive to temp directory for test

spack.test.util.compression.compr_support_check(monkeypatch)[source]
spack.test.util.compression.support_stub()[source]
spack.test.util.compression.test_allowed_archive(path)[source]
spack.test.util.compression.test_get_bad_extension()[source]
spack.test.util.compression.test_get_extension(archive)[source]
spack.test.util.compression.test_native_unpacking(tmpdir_factory, archive_file)[source]
spack.test.util.compression.test_system_unpacking(tmpdir_factory, archive_file, compr_support_check)[source]
spack.test.util.compression.test_unallowed_extension()[source]

spack.test.util.editor module

spack.test.util.editor.bad_exe(tmpdir_factory)[source]
spack.test.util.editor.good_exe(tmpdir_factory)[source]
spack.test.util.editor.nosuch_exe(tmpdir_factory)[source]
spack.test.util.editor.test_editor_both_bad(nosuch_exe, vim_exe)[source]
spack.test.util.editor.test_editor_no_visual(good_exe)[source]
spack.test.util.editor.test_editor_no_visual_with_args(good_exe)[source]
spack.test.util.editor.test_editor_visual(good_exe)[source]
spack.test.util.editor.test_editor_visual_bad(good_exe, bad_exe)[source]
spack.test.util.editor.test_find_exe_from_env_var(good_exe)[source]
spack.test.util.editor.test_find_exe_from_env_var_bad_path(nosuch_exe)[source]
spack.test.util.editor.test_find_exe_from_env_var_no_editor()[source]
spack.test.util.editor.test_find_exe_from_env_var_with_args(good_exe)[source]
spack.test.util.editor.test_no_editor()[source]
spack.test.util.editor.vim_exe(tmpdir_factory)[source]

spack.test.util.environment module

Test Spack’s environment utility functions.

spack.test.util.environment.deprioritize_system_paths()[source]
spack.test.util.environment.prepare_environment_for_tests()[source]
spack.test.util.environment.test_dump_environment(prepare_environment_for_tests, tmpdir)[source]
spack.test.util.environment.test_env_flag(prepare_environment_for_tests)[source]
spack.test.util.environment.test_filter_system_paths()[source]
spack.test.util.environment.test_get_path(prepare_environment_for_tests)[source]
spack.test.util.environment.test_is_system_path()[source]
spack.test.util.environment.test_path_put_first(prepare_environment_for_tests)[source]
spack.test.util.environment.test_path_set(prepare_environment_for_tests)[source]
spack.test.util.environment.test_prune_duplicate_paths()[source]
spack.test.util.environment.test_reverse_environment_modifications(working_env)[source]

spack.test.util.executable module

spack.test.util.executable.test_read_unicode(tmpdir, working_env)[source]
spack.test.util.executable.test_which(tmpdir)[source]
spack.test.util.executable.test_which_relative_path_with_slash(tmpdir, working_env)[source]
spack.test.util.executable.test_which_with_slash_ignores_path(tmpdir, working_env)[source]

spack.test.util.file_cache module

Test Spack’s FileCache.

spack.test.util.file_cache.file_cache(tmpdir)[source]

Returns a properly initialized FileCache instance

spack.test.util.file_cache.test_cache_init_entry_fails(file_cache)[source]

Test init_entry failures.

spack.test.util.file_cache.test_cache_write_readonly_cache_fails(file_cache)[source]

Test writing a read-only cached file.

spack.test.util.file_cache.test_delete_is_idempotent(file_cache)[source]

Deleting a non-existent key should be idempotent, to simplify life when running delete with multiple processes

spack.test.util.file_cache.test_write_and_read_cache_file(file_cache)[source]

Test writing then reading a cached file.

spack.test.util.file_cache.test_write_and_remove_cache_file(file_cache)[source]

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

spack.test.util.log_parser module

spack.test.util.log_parser.test_log_parser(tmpdir)[source]

spack.test.util.mock_package module

spack.test.util.mock_package.test_mock_package_possible_dependencies()[source]
spack.test.util.mock_package.test_mock_repo_is_virtual()[source]

spack.test.util.package_hash module

spack.test.util.package_hash.compare_hash_sans_name(eq, spec1, spec2)[source]
spack.test.util.package_hash.compare_sans_name(eq, spec1, spec2)[source]
spack.test.util.package_hash.test_all_same_but_archive_hash(mock_packages, config)[source]

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

spack.test.util.package_hash.test_all_same_but_install(mock_packages, config)[source]
spack.test.util.package_hash.test_all_same_but_name(mock_packages, config)[source]
spack.test.util.package_hash.test_all_same_but_patch_contents(mock_packages, config)[source]
spack.test.util.package_hash.test_all_same_but_patches_to_apply(mock_packages, config)[source]
spack.test.util.package_hash.test_content_hash_all_same_but_archive_hash(mock_packages, config)[source]
spack.test.util.package_hash.test_content_hash_all_same_but_patch_contents(mock_packages, config)[source]
spack.test.util.package_hash.test_content_hash_cannot_get_details_from_ast(mock_packages, config)[source]

Packages hash-test1 and hash-test3 would be considered the same except that hash-test3 conditionally executes a phase based on a “when” directive that Spack cannot evaluate by examining the AST. This test ensures that Spack can compute a content hash for hash-test3. If Spack cannot determine when a phase applies, it adds it by default, so the test also ensures that the hashes differ where Spack includes a phase on account of AST-examination failure.

spack.test.util.package_hash.test_content_hash_different_variants(mock_packages, config)[source]
spack.test.util.package_hash.test_content_hash_not_concretized(mock_packages, config)[source]

Check that Package.content_hash() works on abstract specs.

spack.test.util.package_hash.test_content_hash_parse_dynamic_function_call(mock_packages, config)[source]
spack.test.util.package_hash.test_different_variants(mock_packages, config)[source]
spack.test.util.package_hash.test_hash(mock_packages, config)[source]
spack.test.util.package_hash.test_multimethod_resolution(spec_str, source, expected, not_expected)[source]
spack.test.util.package_hash.test_package_hash_consistency(package_spec, expected_hash)[source]

Ensure that that package hash is consistent python version to version.

We assume these tests run across all supported Python versions in CI, and we ensure consistency with recorded hashes for some well known inputs.

If this fails, then something about the way the python AST works has likely changed. If Spack is running in a new python version, we might need to modify the unparser to handle it. If not, then something has become inconsistent about the way we unparse Python code across versions.

spack.test.util.package_hash.test_remove_all_directives()[source]

Ensure all directives are removed from packages before hashing.

spack.test.util.package_hash.test_remove_complex_package_logic_filtered()[source]
spack.test.util.package_hash.test_remove_docstrings()[source]
spack.test.util.package_hash.test_remove_spack_attributes()[source]

spack.test.util.path module

class spack.test.util.path.TestPathPadding[source]

Bases: object

pytestmark = [Mark(name='skipif', args=(False,), kwargs={'reason': 'Padding funtionality unsupported on Windows'})]
test_longest_prefix_re()[source]

Test that longest_prefix_re generates correct regular expressions.

test_no_substitution()[source]

Ensure that a line not containing one full path placeholder is not modified.

test_output_filtering(capfd, install_mockery, mutable_config)[source]

Test filtering padding out of tty messages.

test_padding_substitution(padded, fixed)[source]

Ensure that all padded lines are unpadded correctly.

test_partial_substitution()[source]

Ensure that a single placeholder path component is replaced

test_short_substitution()[source]

Ensure that a single placeholder path component is replaced

spack.test.util.path.fixed_lines = ["==> [2021-06-23-15:59:05.020387] './configure' '--prefix=/Users/gamblin2/padding-log-test/opt/[padded-to-512-chars]/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga", '/Users/gamblin2/Workspace/spack/lib/spack/env/clang/clang -dynamiclib -install_name /Users/gamblin2/padding-log-test/opt/[padded-to-512-chars]/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.11 -fPIC -O2 -fPIC -DHAVE_HIDDEN -o libz.1.2.11.dylib adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo  -lc', 'rm -f /Users/gamblin2/padding-log-test/opt/[padded-to-512-chars]/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga/lib/libz.a']

unpadded versions of padded_lines, with [padded-to-X-chars] replacing the padding

spack.test.util.path.padded_lines = ["==> [2021-06-23-15:59:05.020387] './configure' '--prefix=/Users/gamblin2/padding-log-test/opt/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_pla/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga", '/Users/gamblin2/Workspace/spack/lib/spack/env/clang/clang -dynamiclib -install_name /Users/gamblin2/padding-log-test/opt/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_pla/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.11 -fPIC -O2 -fPIC -DHAVE_HIDDEN -o libz.1.2.11.dylib adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo  -lc', 'rm -f /Users/gamblin2/padding-log-test/opt/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_pla/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga/lib/libz.a']

Some lines with lots of placeholders

spack.test.util.path.test_path_debug_padded_filter(debug, monkeypatch)[source]

Ensure padded filter works as expected with different debug levels.

spack.test.util.path.test_sanitze_file_path(tmpdir)[source]

Test filtering illegal characters out of potential file paths

spack.test.util.prefix module

Tests various features of spack.util.prefix.Prefix

spack.test.util.prefix.test_multilevel_attributes()[source]

Test attributes of attributes, like prefix.share.man

spack.test.util.prefix.test_prefix_attributes()[source]

Test normal prefix attributes like prefix.bin

spack.test.util.prefix.test_prefix_join()[source]

Test prefix join prefix.join(...)

spack.test.util.prefix.test_string_like_behavior()[source]

Test string-like behavior of the prefix object

spack.test.util.spack_lock_wrapper module

Tests for Spack’s wrapper module around llnl.util.lock.

spack.test.util.spack_lock_wrapper.test_disable_locking(tmpdir)[source]

Ensure that locks do no real locking when disabled.

spack.test.util.spack_lock_wrapper.test_lock_checks_group(tmpdir)[source]

Ensure lock checks work with a self-owned, non-self-group repo.

spack.test.util.spack_lock_wrapper.test_lock_checks_user(tmpdir)[source]

Ensure lock checks work with a self-owned, self-group repo.

spack.test.util.spack_yaml module

spack.test.util.spack_yaml.check_blame(element, file_name, line=None)[source]

Check that config blame config gets right file/line for an element.

This runs spack config blame config and scrapes the output for a particular YAML key. It thne checks that the requested file/line info is also on that line.

Line is optional; if it is None we just check for the file_name, which may just be a name for a special config scope like _builtin or command_line.

spack.test.util.spack_yaml.get_config_line(pattern, lines)[source]

Get a configuration line that matches a particular pattern.

spack.test.util.spack_yaml.test_config_blame(config)[source]

check blame info for elements in mock configuration.

spack.test.util.spack_yaml.test_config_blame_defaults()[source]

check blame for an element from an override scope

spack.test.util.spack_yaml.test_config_blame_with_override(config)[source]

check blame for an element from an override scope

spack.test.util.util_gpg module

spack.test.util.util_gpg.has_socket_dir()[source]
spack.test.util.util_gpg.test_parse_gpg_output_case_one()[source]
spack.test.util.util_gpg.test_parse_gpg_output_case_three()[source]
spack.test.util.util_gpg.test_parse_gpg_output_case_two()[source]
spack.test.util.util_gpg.test_really_long_gnupghome_dir(tmpdir, has_socket_dir)[source]

spack.test.util.util_string module

spack.test.util.util_string.test_plural()[source]

spack.test.util.util_url module

Test Spack’s URL handling utility functions.

spack.test.util.util_url.test_git_url_parse(url, parts)[source]
spack.test.util.util_url.test_url_join_absolute_paths()[source]
spack.test.util.util_url.test_url_join_local_paths()[source]
spack.test.util.util_url.test_url_local_file_path()[source]
spack.test.util.util_url.test_url_parse()[source]

Module contents