Add package tests

This commit is contained in:
psakiev 2025-03-29 22:51:23 -06:00
parent a5f0ba5692
commit dc1b0662d9
2 changed files with 15 additions and 0 deletions

View File

@ -333,3 +333,17 @@ def test_package_can_have_sparse_checkout_properties(mock_packages, mock_fetch,
assert isinstance(fetcher, spack.fetch_strategy.GitFetchStrategy)
assert hasattr(fetcher, "git_sparse_paths")
assert fetcher.git_sparse_paths == pkg_cls.git_sparse_paths
def test_phil_package_can_depend_on_commit_of_dependency(mock_packages, config):
spec = spack.concretize.concretize_one(Spec("git-ref-commit-dep@1.0.0"))
assert spec.satisfies(f"^git-ref-package commit={'a' * 40}")
assert "surgical" not in spec["git-ref-package"].variants
def test_phil_package_condtional_variants_may_depend_on_commit(mock_packages, config):
spec = spack.concretize.concretize_one(Spec("git-ref-commit-dep@develop"))
assert spec.satisfies(f"^git-ref-package commit={'b' * 40}")
conditional_variant = spec["git-ref-package"].variants.get("surgical", None)
assert conditional_variant
assert conditional_variant.value

View File

@ -37,6 +37,7 @@ class GitRefPackage(AutotoolsPackage):
variant("opt", default=True, description="Enable optimizations")
variant("shared", default=True, description="Build shared library")
variant("pic", default=True, description="Enable position-independent code (PIC)")
variant("surgical", default=True, when=f"commit={'b' * 40}", description="Testing conditional on commit")
conflicts("+shared~pic")