Add tests
This commit is contained in:
parent
251af651c9
commit
1199b1ef99
@ -3305,3 +3305,31 @@ def _ensure_cache_hits(self, problem: str):
|
|||||||
# object
|
# object
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
assert h == spack.concretize.concretize_one("hdf5")
|
assert h == spack.concretize.concretize_one("hdf5")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("mutable_config", "mock_packages", "do_not_check_runtimes_on_reuse")
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"spec_str, should_pass, error_type",
|
||||||
|
[
|
||||||
|
(f"git-ref-package@main commit={'a' *40}", True, None),
|
||||||
|
(f"git-ref-package@main commit={'a' *39}", False, AssertionError),
|
||||||
|
# TODO only versions with git refs should allow the commit variant
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_spec_containing_commit_variant(spec_str, should_pass, error_type):
|
||||||
|
spec = spack.spec.Spec(spec_str)
|
||||||
|
if should_pass:
|
||||||
|
spec.concretize()
|
||||||
|
else:
|
||||||
|
with pytest.raises(error_type):
|
||||||
|
spec.concretize()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("mutable_config", "mock_packages", "do_not_check_runtimes_on_reuse")
|
||||||
|
@pytest.mark.parametrize("version_str", [f"git.{'a' *40}=main", "git.2.1.5=main"])
|
||||||
|
def test_relationship_git_versions_and_commit_variant(version_str):
|
||||||
|
spec = spack.spec.Spec(f"git-ref-package@{version_str}").concretized()
|
||||||
|
if spec.version.commit_sha:
|
||||||
|
assert spec.version.commit_sha == spec.variants["commit"].value
|
||||||
|
else:
|
||||||
|
assert "commit" not in spec.variants
|
||||||
|
@ -14,6 +14,7 @@ class GitRefPackage(AutotoolsPackage):
|
|||||||
url = "https://github.com/dummy/dummy/archive/2.0.0.tar.gz"
|
url = "https://github.com/dummy/dummy/archive/2.0.0.tar.gz"
|
||||||
git = "https://github.com/dummy/dummy.git"
|
git = "https://github.com/dummy/dummy.git"
|
||||||
|
|
||||||
|
version("main", branch="main")
|
||||||
version("2.1.6", sha256="a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2")
|
version("2.1.6", sha256="a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2")
|
||||||
version("2.1.5", sha256="3f6576971397b379d4205ae5451ff5a68edf6c103b2f03c4188ed7075fbb5f04")
|
version("2.1.5", sha256="3f6576971397b379d4205ae5451ff5a68edf6c103b2f03c4188ed7075fbb5f04")
|
||||||
version("2.1.4", sha256="a0293475e6a44a3f6c045229fe50f69dc0eebc62a42405a51f19d46a5541e77a")
|
version("2.1.4", sha256="a0293475e6a44a3f6c045229fe50f69dc0eebc62a42405a51f19d46a5541e77a")
|
||||||
|
Loading…
Reference in New Issue
Block a user