summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-10-12 02:25:41 +0200
committerGitHub <noreply@github.com>2024-10-12 00:25:41 +0000
commitd5966e676debaa7674e69b227a293ad6daa2228a (patch)
tree516a9d2fe1a762aac5ee5e7f5a23ca41f67265d2
parente187508485171bc86a65fdb2c0f2c68a079e8ff5 (diff)
downloadspack-d5966e676debaa7674e69b227a293ad6daa2228a.tar.gz
spack-d5966e676debaa7674e69b227a293ad6daa2228a.tar.bz2
spack-d5966e676debaa7674e69b227a293ad6daa2228a.tar.xz
spack-d5966e676debaa7674e69b227a293ad6daa2228a.zip
Fix splicing related unit tests (#46914)
Some assertion are not testing DAG invariants, and they are passing only because of the simple structure of the builtin.mock repository on develop. Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
-rw-r--r--lib/spack/spack/test/cmd/env.py3
-rw-r--r--lib/spack/spack/test/concretize.py3
-rw-r--r--lib/spack/spack/test/installer.py6
3 files changed, 7 insertions, 5 deletions
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
index 014151688a..70e2c56e41 100644
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -833,7 +833,8 @@ spack:
# The one spec is mpileaks
for _, spec in e2.concretized_specs():
assert spec.spliced
- assert spec["mpi"].satisfies(zmpi)
+ assert spec["mpi"].satisfies(f"zmpi@{zmpi.version}")
+ assert spec["mpi"].build_spec.satisfies(zmpi)
def test_init_from_lockfile(environment_from_manifest):
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 04807d6cde..b56f05b601 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -2295,8 +2295,9 @@ class TestConcretize:
spec = spack.spec.Spec("hdf5 ^zmpi").concretized()
- assert spec.satisfies(f"^mpich/{mpich_spec.dag_hash()}")
+ assert spec.satisfies(f"^mpich@{mpich_spec.version}")
assert spec.build_spec.dependencies(name="zmpi", deptype="link")
+ assert spec["mpi"].build_spec.satisfies(mpich_spec)
assert not spec.build_spec.satisfies(f"^mpich/{mpich_spec.dag_hash()}")
assert not spec.dependencies(name="zmpi", deptype="link")
diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py
index bf231c0f2a..8df6a1a6ea 100644
--- a/lib/spack/spack/test/installer.py
+++ b/lib/spack/spack/test/installer.py
@@ -967,7 +967,7 @@ def test_install_fail_on_interrupt(install_mockery, mock_fetch, monkeypatch):
"""Test ctrl-c interrupted install."""
spec_name = "pkg-a"
err_msg = "mock keyboard interrupt for {0}".format(spec_name)
- installer = create_installer([spec_name], {})
+ installer = create_installer([spec_name], {"fake": True})
setattr(inst.PackageInstaller, "_real_install_task", inst.PackageInstaller._install_task)
# Raise a KeyboardInterrupt error to trigger early termination
monkeypatch.setattr(inst.PackageInstaller, "_install_task", _interrupt)
@@ -997,7 +997,7 @@ def _install_fail_my_build_exception(installer, task, install_status, **kwargs):
def test_install_fail_single(install_mockery, mock_fetch, monkeypatch):
"""Test expected results for failure of single package."""
- installer = create_installer(["pkg-a"], {})
+ installer = create_installer(["pkg-a"], {"fake": True})
# Raise a KeyboardInterrupt error to trigger early termination
monkeypatch.setattr(inst.PackageInstaller, "_install_task", _install_fail_my_build_exception)
@@ -1012,7 +1012,7 @@ def test_install_fail_single(install_mockery, mock_fetch, monkeypatch):
def test_install_fail_multi(install_mockery, mock_fetch, monkeypatch):
"""Test expected results for failure of multiple packages."""
- installer = create_installer(["pkg-a", "pkg-c"], {})
+ installer = create_installer(["pkg-a", "pkg-c"], {"fake": True})
# Raise a KeyboardInterrupt error to trigger early termination
monkeypatch.setattr(inst.PackageInstaller, "_install_task", _install_fail_my_build_exception)