diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2024-07-09 11:23:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-09 11:23:49 +0200 |
commit | 54ee7d4165824a0e2fd81c91411f71ad50a8106a (patch) | |
tree | 1c15b978d211dc967f956b7484819f614c9cd5c9 /lib | |
parent | 15efcbe042692ebd6a634add316fb6564e26642c (diff) | |
download | spack-54ee7d4165824a0e2fd81c91411f71ad50a8106a.tar.gz spack-54ee7d4165824a0e2fd81c91411f71ad50a8106a.tar.bz2 spack-54ee7d4165824a0e2fd81c91411f71ad50a8106a.tar.xz spack-54ee7d4165824a0e2fd81c91411f71ad50a8106a.zip |
Remove the "install_mockery_mutable_config" fixture (#45129)
This fixture was introduced in #16429, and made
redundant in #39024
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/bindist.py | 16 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/buildcache.py | 9 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/ci.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/install.py | 34 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/mirror.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/test.py | 39 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 6 | ||||
-rw-r--r-- | lib/spack/spack/test/conftest.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/test/package_class.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/test/test_suite.py | 22 |
10 files changed, 42 insertions, 123 deletions
diff --git a/lib/spack/spack/test/bindist.py b/lib/spack/spack/test/bindist.py index 2489eaf294..d80ddfe6e5 100644 --- a/lib/spack/spack/test/bindist.py +++ b/lib/spack/spack/test/bindist.py @@ -105,11 +105,11 @@ def config_directory(tmpdir_factory): @pytest.fixture(scope="function") -def default_config(tmpdir, config_directory, monkeypatch, install_mockery_mutable_config): - # This fixture depends on install_mockery_mutable_config to ensure +def default_config(tmpdir, config_directory, monkeypatch, install_mockery): + # This fixture depends on install_mockery to ensure # there is a clear order of initialization. The substitution of the # config scopes here is done on top of the substitution that comes with - # install_mockery_mutable_config + # install_mockery mutable_dir = tmpdir.mkdir("mutable_config").join("tmp") config_directory.copy(mutable_dir) @@ -398,9 +398,7 @@ def fake_dag_hash(spec, length=None): return "tal4c7h4z0gqmixb1eqa92mjoybxn5l6"[:length] -@pytest.mark.usefixtures( - "install_mockery_mutable_config", "mock_packages", "mock_fetch", "test_mirror" -) +@pytest.mark.usefixtures("install_mockery", "mock_packages", "mock_fetch", "test_mirror") def test_spec_needs_rebuild(monkeypatch, tmpdir): """Make sure needs_rebuild properly compares remote hash against locally computed one, avoiding unnecessary rebuilds""" @@ -429,7 +427,7 @@ def test_spec_needs_rebuild(monkeypatch, tmpdir): assert rebuild -@pytest.mark.usefixtures("install_mockery_mutable_config", "mock_packages", "mock_fetch") +@pytest.mark.usefixtures("install_mockery", "mock_packages", "mock_fetch") def test_generate_index_missing(monkeypatch, tmpdir, mutable_config): """Ensure spack buildcache index only reports available packages""" @@ -587,9 +585,7 @@ def test_update_sbang(tmpdir, test_mirror): str(archspec.cpu.host().family) != "x86_64", reason="test data uses gcc 4.5.0 which does not support aarch64", ) -def test_install_legacy_buildcache_layout( - mutable_config, compiler_factory, install_mockery_mutable_config -): +def test_install_legacy_buildcache_layout(mutable_config, compiler_factory, install_mockery): """Legacy buildcache layout involved a nested archive structure where the .spack file contained a repeated spec.json and another compressed archive file containing the install tree. This test diff --git a/lib/spack/spack/test/cmd/buildcache.py b/lib/spack/spack/test/cmd/buildcache.py index b72d753fc3..df4fa72a85 100644 --- a/lib/spack/spack/test/cmd/buildcache.py +++ b/lib/spack/spack/test/cmd/buildcache.py @@ -189,12 +189,7 @@ def test_buildcache_autopush(tmp_path, install_mockery, mock_fetch): def test_buildcache_sync( - mutable_mock_env_path, - install_mockery_mutable_config, - mock_packages, - mock_fetch, - mock_stage, - tmpdir, + mutable_mock_env_path, install_mockery, mock_packages, mock_fetch, mock_stage, tmpdir ): """ Make sure buildcache sync works in an environment-aware manner, ignoring @@ -323,7 +318,7 @@ def test_buildcache_sync( def test_buildcache_create_install( mutable_mock_env_path, - install_mockery_mutable_config, + install_mockery, mock_packages, mock_fetch, mock_stage, diff --git a/lib/spack/spack/test/cmd/ci.py b/lib/spack/spack/test/cmd/ci.py index edd90bbbd5..ff37a00997 100644 --- a/lib/spack/spack/test/cmd/ci.py +++ b/lib/spack/spack/test/cmd/ci.py @@ -748,7 +748,7 @@ def test_ci_rebuild_mock_success( tmpdir, working_env, mutable_mock_env_path, - install_mockery_mutable_config, + install_mockery, mock_gnupghome, mock_stage, mock_fetch, @@ -782,7 +782,7 @@ def test_ci_rebuild_mock_failure_to_push( tmpdir, working_env, mutable_mock_env_path, - install_mockery_mutable_config, + install_mockery, mock_gnupghome, mock_stage, mock_fetch, @@ -820,7 +820,7 @@ def test_ci_rebuild( tmpdir, working_env, mutable_mock_env_path, - install_mockery_mutable_config, + install_mockery, mock_packages, monkeypatch, mock_gnupghome, @@ -1019,7 +1019,7 @@ spack: def test_ci_generate_mirror_override( tmpdir, mutable_mock_env_path, - install_mockery_mutable_config, + install_mockery, mock_packages, mock_fetch, mock_stage, @@ -1104,7 +1104,7 @@ spack: def test_push_to_build_cache( tmpdir, mutable_mock_env_path, - install_mockery_mutable_config, + install_mockery, mock_packages, mock_fetch, mock_stage, diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 2466d4e27f..67d49cf2c2 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -923,12 +923,7 @@ def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd): @pytest.mark.not_on_windows("ArchSpec gives test platform debian rather than windows") def test_compiler_bootstrap( - install_mockery_mutable_config, - mock_packages, - mock_fetch, - mock_archive, - mutable_config, - monkeypatch, + install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch ): monkeypatch.setattr(spack.concretize.Concretizer, "check_for_compiler_existence", False) spack.config.set("config:install_missing_compilers", True) @@ -940,13 +935,7 @@ def test_compiler_bootstrap( @pytest.mark.not_on_windows("Binary mirrors not supported on windows") def test_compiler_bootstrap_from_binary_mirror( - install_mockery_mutable_config, - mock_packages, - mock_fetch, - mock_archive, - mutable_config, - monkeypatch, - tmpdir, + install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch, tmpdir ): """ Make sure installing compiler from buildcache registers compiler @@ -982,12 +971,7 @@ def test_compiler_bootstrap_from_binary_mirror( @pytest.mark.not_on_windows("ArchSpec gives test platform debian rather than windows") @pytest.mark.regression("16221") def test_compiler_bootstrap_already_installed( - install_mockery_mutable_config, - mock_packages, - mock_fetch, - mock_archive, - mutable_config, - monkeypatch, + install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch ): monkeypatch.setattr(spack.concretize.Concretizer, "check_for_compiler_existence", False) spack.config.set("config:install_missing_compilers", True) @@ -1087,13 +1071,7 @@ def test_installation_fail_tests(install_mockery, mock_fetch, name, method): @pytest.mark.not_on_windows("Buildcache not supported on windows") def test_install_use_buildcache( - capsys, - mock_packages, - mock_fetch, - mock_archive, - mock_binary_index, - tmpdir, - install_mockery_mutable_config, + capsys, mock_packages, mock_fetch, mock_archive, mock_binary_index, tmpdir, install_mockery ): """ Make sure installing with use-buildcache behaves correctly. @@ -1166,14 +1144,14 @@ def test_install_use_buildcache( @pytest.mark.not_on_windows("Windows logger I/O operation on closed file when install fails") @pytest.mark.regression("34006") @pytest.mark.disable_clean_stage_check -def test_padded_install_runtests_root(install_mockery_mutable_config, mock_fetch): +def test_padded_install_runtests_root(install_mockery, mock_fetch): spack.config.set("config:install_tree:padded_length", 255) output = install("--test=root", "--no-cache", "test-build-callbacks", fail_on_error=False) assert output.count("method not implemented") == 1 @pytest.mark.regression("35337") -def test_report_filename_for_cdash(install_mockery_mutable_config, mock_fetch): +def test_report_filename_for_cdash(install_mockery, mock_fetch): """Test that the temporary file used to write the XML for CDash is not the upload URL""" parser = argparse.ArgumentParser() spack.cmd.install.setup_parser(parser) diff --git a/lib/spack/spack/test/cmd/mirror.py b/lib/spack/spack/test/cmd/mirror.py index 37253074a1..c1e24a9825 100644 --- a/lib/spack/spack/test/cmd/mirror.py +++ b/lib/spack/spack/test/cmd/mirror.py @@ -232,13 +232,7 @@ def test_mirror_name_collision(mutable_config): def test_mirror_destroy( - install_mockery_mutable_config, - mock_packages, - mock_fetch, - mock_archive, - mutable_config, - monkeypatch, - tmpdir, + install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch, tmpdir ): # Create a temp mirror directory for buildcache usage mirror_dir = tmpdir.join("mirror_dir") diff --git a/lib/spack/spack/test/cmd/test.py b/lib/spack/spack/test/cmd/test.py index 6f72376348..24ad2e5b8a 100644 --- a/lib/spack/spack/test/cmd/test.py +++ b/lib/spack/spack/test/cmd/test.py @@ -48,7 +48,7 @@ def test_test_dirty_flag(arguments, expected): def test_test_dup_alias( - mock_test_stage, mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config, capfd + mock_test_stage, mock_packages, mock_archive, mock_fetch, install_mockery, capfd ): """Ensure re-using an alias fails with suggestion to change.""" install("libdwarf") @@ -63,9 +63,7 @@ def test_test_dup_alias( assert "already exists" in out and "Try another alias" in out -def test_test_output( - mock_test_stage, mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config -): +def test_test_output(mock_test_stage, mock_packages, mock_archive, mock_fetch, install_mockery): """Ensure output printed from pkgs is captured by output redirection.""" install("printing-package") spack_test("run", "--alias", "printpkg", "printing-package") @@ -91,13 +89,7 @@ def test_test_output( "pkg_name,failure", [("test-error", "exited with status 1"), ("test-fail", "not callable")] ) def test_test_output_fails( - mock_packages, - mock_archive, - mock_fetch, - install_mockery_mutable_config, - mock_test_stage, - pkg_name, - failure, + mock_packages, mock_archive, mock_fetch, install_mockery, mock_test_stage, pkg_name, failure ): """Confirm stand-alone test failure with expected outputs.""" install(pkg_name) @@ -111,9 +103,7 @@ def test_test_output_fails( assert "See test log for details" in out -@pytest.mark.usefixtures( - "mock_packages", "mock_archive", "mock_fetch", "install_mockery_mutable_config" -) +@pytest.mark.usefixtures("mock_packages", "mock_archive", "mock_fetch", "install_mockery") @pytest.mark.parametrize( "pkg_name,msgs", [ @@ -147,13 +137,7 @@ def test_junit_output_with_failures(tmpdir, mock_test_stage, pkg_name, msgs): def test_cdash_output_test_error( - tmpdir, - mock_fetch, - install_mockery_mutable_config, - mock_packages, - mock_archive, - mock_test_stage, - capfd, + tmpdir, mock_fetch, install_mockery, mock_packages, mock_archive, mock_test_stage, capfd ): """Confirm stand-alone test error expected outputs in CDash reporting.""" install("test-error") @@ -173,12 +157,7 @@ def test_cdash_output_test_error( def test_cdash_upload_clean_test( - tmpdir, - mock_fetch, - install_mockery_mutable_config, - mock_packages, - mock_archive, - mock_test_stage, + tmpdir, mock_fetch, install_mockery, mock_packages, mock_archive, mock_test_stage ): install("printing-package") with tmpdir.as_cwd(): @@ -227,7 +206,7 @@ def test_test_list_all(mock_packages): ) -def test_test_list(mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config): +def test_test_list(mock_packages, mock_archive, mock_fetch, install_mockery): pkg_with_tests = "printing-package" install(pkg_with_tests) output = spack_test("list") @@ -293,7 +272,7 @@ def test_test_results_status(mock_packages, mock_test_stage, status): @pytest.mark.regression("35337") -def test_report_filename_for_cdash(install_mockery_mutable_config, mock_fetch): +def test_report_filename_for_cdash(install_mockery, mock_fetch): """Test that the temporary file used to write Testing.xml for CDash is not the upload URL""" name = "trivial" spec = spack.spec.Spec("trivial-smoke-test").concretized() @@ -316,7 +295,7 @@ def test_report_filename_for_cdash(install_mockery_mutable_config, mock_fetch): def test_test_output_multiple_specs( - mock_test_stage, mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config + mock_test_stage, mock_packages, mock_archive, mock_fetch, install_mockery ): """Ensure proper reporting for suite with skipped, failing, and passed tests.""" install("test-error", "simple-standalone-test@0.9", "simple-standalone-test@1.0") diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 055b0ee6e5..fb261ff0d5 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -3063,9 +3063,7 @@ def test_spec_filters(specs, include, exclude, expected): @pytest.mark.only_clingo("clingo only reuse feature being tested") @pytest.mark.regression("38484") -def test_git_ref_version_can_be_reused( - install_mockery_mutable_config, do_not_check_runtimes_on_reuse -): +def test_git_ref_version_can_be_reused(install_mockery, do_not_check_runtimes_on_reuse): first_spec = spack.spec.Spec("git-ref-package@git.2.1.5=2.1.5~opt").concretized() first_spec.package.do_install(fake=True, explicit=True) @@ -3084,7 +3082,7 @@ def test_git_ref_version_can_be_reused( @pytest.mark.only_clingo("clingo only reuse feature being tested") @pytest.mark.parametrize("standard_version", ["2.0.0", "2.1.5", "2.1.6"]) def test_reuse_prefers_standard_over_git_versions( - standard_version, install_mockery_mutable_config, do_not_check_runtimes_on_reuse + standard_version, install_mockery, do_not_check_runtimes_on_reuse ): """ order matters in this test. typically reuse would pick the highest versioned installed match diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 8c306811ce..62b257a64e 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -998,19 +998,6 @@ def temporary_store(tmpdir, request): temporary_store_path.remove() -@pytest.fixture(scope="function") -def install_mockery_mutable_config(temporary_store, mutable_config, mock_packages): - """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. - """ - # We use a fake package, so temporarily disable checksumming - with spack.config.override("config:checksum", False): - yield - - @pytest.fixture() def mock_fetch(mock_archive, monkeypatch): """Fake the URL for a package so it downloads from a file.""" diff --git a/lib/spack/spack/test/package_class.py b/lib/spack/spack/test/package_class.py index 915a53400d..f3426e23ce 100644 --- a/lib/spack/spack/test/package_class.py +++ b/lib/spack/spack/test/package_class.py @@ -293,7 +293,7 @@ def test_package_test_no_compilers(mock_packages, monkeypatch, capfd): ], ) def test_package_run_test_install( - install_mockery_mutable_config, mock_fetch, capfd, msg, installed, purpose, expected + install_mockery, mock_fetch, capfd, msg, installed, purpose, expected ): """Confirm expected outputs from run_test for installed/not installed exe.""" s = spack.spec.Spec("trivial-smoke-test").concretized() @@ -314,9 +314,7 @@ def test_package_run_test_install( (False, 1, str(spack.install_test.TestStatus.FAILED)), ], ) -def test_package_run_test_missing( - install_mockery_mutable_config, mock_fetch, capfd, skip, failures, status -): +def test_package_run_test_missing(install_mockery, mock_fetch, capfd, skip, failures, status): """Confirm expected results from run_test for missing exe when skip or not.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package @@ -328,7 +326,7 @@ def test_package_run_test_missing( # TODO (post-34236): Remove when remove deprecated run_test(), etc. -def test_package_run_test_fail_fast(install_mockery_mutable_config, mock_fetch): +def test_package_run_test_fail_fast(install_mockery, mock_fetch): """Confirm expected exception when run_test with fail_fast enabled.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package diff --git a/lib/spack/spack/test/test_suite.py b/lib/spack/spack/test/test_suite.py index 6af98b6f2f..200709587d 100644 --- a/lib/spack/spack/test/test_suite.py +++ b/lib/spack/spack/test/test_suite.py @@ -291,7 +291,7 @@ def test_process_test_parts(mock_packages): assert "test suite is missing" in str(exc_info) -def test_test_part_fail(tmpdir, install_mockery_mutable_config, mock_fetch, mock_test_stage): +def test_test_part_fail(tmpdir, install_mockery, mock_fetch, mock_test_stage): """Confirm test_part with a ProcessError results in FAILED status.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package @@ -307,7 +307,7 @@ def test_test_part_fail(tmpdir, install_mockery_mutable_config, mock_fetch, mock assert status == TestStatus.FAILED -def test_test_part_pass(install_mockery_mutable_config, mock_fetch, mock_test_stage): +def test_test_part_pass(install_mockery, mock_fetch, mock_test_stage): """Confirm test_part that succeeds results in PASSED status.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package @@ -323,7 +323,7 @@ def test_test_part_pass(install_mockery_mutable_config, mock_fetch, mock_test_st assert status == TestStatus.PASSED -def test_test_part_skip(install_mockery_mutable_config, mock_fetch, mock_test_stage): +def test_test_part_skip(install_mockery, mock_fetch, mock_test_stage): """Confirm test_part that raises SkipTest results in test status SKIPPED.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package @@ -337,9 +337,7 @@ def test_test_part_skip(install_mockery_mutable_config, mock_fetch, mock_test_st assert status == TestStatus.SKIPPED -def test_test_part_missing_exe_fail_fast( - tmpdir, install_mockery_mutable_config, mock_fetch, mock_test_stage -): +def test_test_part_missing_exe_fail_fast(tmpdir, install_mockery, mock_fetch, mock_test_stage): """Confirm test_part with fail fast enabled raises exception.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package @@ -360,9 +358,7 @@ def test_test_part_missing_exe_fail_fast( assert status == TestStatus.FAILED -def test_test_part_missing_exe( - tmpdir, install_mockery_mutable_config, mock_fetch, mock_test_stage -): +def test_test_part_missing_exe(tmpdir, install_mockery, mock_fetch, mock_test_stage): """Confirm test_part with missing executable fails.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package @@ -396,7 +392,7 @@ def test_test_part_missing_exe( ], ) def test_embedded_test_part_status( - install_mockery_mutable_config, mock_fetch, mock_test_stage, current, substatuses, expected + install_mockery, mock_fetch, mock_test_stage, current, substatuses, expected ): """Check to ensure the status of the enclosing test part reflects summary of embedded parts.""" @@ -424,7 +420,7 @@ def test_embedded_test_part_status( ], ) def test_write_tested_status( - tmpdir, install_mockery_mutable_config, mock_fetch, mock_test_stage, statuses, expected + tmpdir, install_mockery, mock_fetch, mock_test_stage, statuses, expected ): """Check to ensure the status of the enclosing test part reflects summary of embedded parts.""" s = spack.spec.Spec("trivial-smoke-test").concretized() @@ -441,9 +437,7 @@ def test_write_tested_status( @pytest.mark.regression("37840") -def test_write_tested_status_no_repeats( - tmpdir, install_mockery_mutable_config, mock_fetch, mock_test_stage -): +def test_write_tested_status_no_repeats(tmpdir, install_mockery, mock_fetch, mock_test_stage): """Emulate re-running the same stand-alone tests a second time.""" s = spack.spec.Spec("trivial-smoke-test").concretized() pkg = s.package |