Fix tests and test reuse
This commit is contained in:
parent
7b68d31143
commit
72cf35aeab
@ -356,10 +356,6 @@ error(10, "Commit '{0}' must match package.py value '{1}' for '{2}@={3}'", Vsha,
|
||||
Vsha == Psha,
|
||||
VersionA != VersionB.
|
||||
|
||||
% rule that says if a spec has a commit choose the max version that can accept a commit
|
||||
|
||||
% rule that says if a constraint is on a commit and a version matches that commit then the constraint is on the version
|
||||
|
||||
#defined version_satisfies/3.
|
||||
#defined deprecated_versions_not_allowed/0.
|
||||
#defined deprecated_version/2.
|
||||
|
@ -2735,11 +2735,6 @@ def test_phil_git_based_version_must_exist_to_use_ref(self):
|
||||
spack.concretize.concretize_one(f"gmake commit={'a' * 40}")
|
||||
assert "Cannot use commit variant with" in e.value.message
|
||||
|
||||
@pytest.mark.skip("not supporting on this branch")
|
||||
def test_phil_commit_variant_in_absence_of_version_selects_max_infinity_version(self):
|
||||
spec = spack.concretize.concretize_one(f"git-ref-package commit={'a' * 40}")
|
||||
assert spec.satisfies("@develop")
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def duplicates_test_repository():
|
||||
@ -3320,7 +3315,7 @@ def test_phil_spec_with_commit_interacts_with_lookup(
|
||||
@pytest.mark.parametrize("version_str", [f"git.{'a' * 40}=main", "git.2.1.5=main"])
|
||||
def test_phil_relationship_git_versions_and_commit_variant(version_str):
|
||||
"""
|
||||
Confirm that GitVersions auto assign and poopulate the commit variant correctly
|
||||
Confirm that GitVersions auto assign and populates the commit variant correctly
|
||||
"""
|
||||
# This should be a short lived test and can be deleted when we remove GitVersions
|
||||
spec = spack.spec.Spec(f"git-ref-package@{version_str}")
|
||||
@ -3331,6 +3326,46 @@ def test_phil_relationship_git_versions_and_commit_variant(version_str):
|
||||
assert "commit" not in spec.variants
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("install_mockery", "do_not_check_runtimes_on_reuse")
|
||||
def test_phil_abstract_commit_spec_reuse():
|
||||
commit = "abcd" * 10
|
||||
spec_str_1 = f"git-ref-package@develop commit={commit}"
|
||||
spec_str_2 = f"git-ref-package commit={commit}"
|
||||
spec1 = spack.concretize.concretize_one(spack.spec.Spec(spec_str_1))
|
||||
PackageInstaller([spec1.package], fake=True, explicit=True).install()
|
||||
|
||||
with spack.config.override("concretizer:reuse", True):
|
||||
spec2 = spack.spec.Spec(spec_str_2)
|
||||
spec2 = spack.concretize.concretize_one(spec2)
|
||||
assert spec1.dag_hash() == spec2.dag_hash()
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("install_mockery", "do_not_check_runtimes_on_reuse")
|
||||
@pytest.mark.parametrize(
|
||||
"installed_commit, incoming_commit, reusable",
|
||||
[("a" * 40, "b" * 40, False), (None, "b" * 40, False), ("a" * 40, None, True)],
|
||||
)
|
||||
def test_phil_commit_variant_can_be_reused(installed_commit, incoming_commit, reusable):
|
||||
# install a non-default variant to test if reuse picks it
|
||||
if installed_commit:
|
||||
spec_str_1 = f"git-ref-package@develop commit={installed_commit} ~opt"
|
||||
else:
|
||||
spec_str_1 = "git-ref-package@develop ~opt"
|
||||
|
||||
if incoming_commit:
|
||||
spec_str_2 = f"git-ref-package@develop commit={incoming_commit}"
|
||||
else:
|
||||
spec_str_2 = "git-ref-package@develop"
|
||||
|
||||
spec1 = spack.concretize.concretize_one(spack.spec.Spec(spec_str_1))
|
||||
PackageInstaller([spec1.package], fake=True, explicit=True).install()
|
||||
|
||||
with spack.config.override("concretizer:reuse", True):
|
||||
spec2 = spack.spec.Spec(spec_str_2)
|
||||
spec2 = spack.concretize.concretize_one(spec2)
|
||||
assert (spec1.dag_hash() == spec2.dag_hash()) == reusable
|
||||
|
||||
|
||||
def test_concretization_cache_roundtrip(use_concretization_cache, monkeypatch, mutable_config):
|
||||
"""Tests whether we can write the results of a clingo solve to the cache
|
||||
and load the same spec request from the cache to produce identical specs"""
|
||||
|
@ -349,7 +349,6 @@ def test_phil_package_condtional_variants_may_depend_on_commit(mock_packages, co
|
||||
assert conditional_variant.value
|
||||
|
||||
|
||||
@pytest.mark.skip("not supporting on this branch")
|
||||
def test_phil_commit_variant_finds_matches_for_commit_versions(mock_packages, config):
|
||||
"""
|
||||
test conditional dependence on `when='commit=<sha>'`
|
||||
@ -357,4 +356,4 @@ def test_phil_commit_variant_finds_matches_for_commit_versions(mock_packages, co
|
||||
that commit is associated with the stable version of git-ref-package
|
||||
"""
|
||||
spec = spack.concretize.concretize_one(Spec("git-ref-commit-dep+commit-selector"))
|
||||
assert spec.satisfies("^git-ref-package@stable")
|
||||
assert spec.satisfies(f"^git-ref-package commit={'c' * 40}")
|
||||
|
@ -15,6 +15,7 @@ class GitRefCommitDep(AutotoolsPackage):
|
||||
url = git
|
||||
|
||||
version("develop", branch="develop")
|
||||
version("main", branch="main")
|
||||
version("1.0.0", sha256="a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2")
|
||||
|
||||
variant("commit-selector", default=False, description="test grabbing a specific commit")
|
||||
|
Loading…
Reference in New Issue
Block a user