From 011da2d44a727965ab312e309bd7e600d998ad85 Mon Sep 17 00:00:00 2001 From: Philip Sakievich Date: Sat, 15 Feb 2025 07:22:30 -0700 Subject: [PATCH] dev_path and commit mutually exclusive --- lib/spack/spack/solver/asp.py | 3 +++ lib/spack/spack/test/concretization/core.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 48acaef7ba3..9ed0b8361d9 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -4278,6 +4278,9 @@ def _specs_with_commits(spec): if not (has_commit_var or has_git_version): return + if "dev_path" in spec.variants: + assert False + # Specs with commit variants # - variant value satsifies commit regex # - paired to a GitVersion or version that is associated with a branch/tag diff --git a/lib/spack/spack/test/concretization/core.py b/lib/spack/spack/test/concretization/core.py index 60f82fcbdcb..b10016572b1 100644 --- a/lib/spack/spack/test/concretization/core.py +++ b/lib/spack/spack/test/concretization/core.py @@ -3311,11 +3311,13 @@ def _ensure_cache_hits(self, problem: str): @pytest.mark.parametrize( "spec_str, should_pass, error_type", [ + # TODO write actual Exceptions for these to give good error messages (f"git-ref-package@main commit={'a' * 40}", True, None), (f"git-ref-package@main commit={'a' * 39}", False, AssertionError), (f"git-ref-package@2.1.6 commit={'a' * 40}", False, AssertionError), (f"git-ref-package@git.2.1.6=2.1.6 commit={'a' * 40}", True, None), (f"git-ref-package@2.1.6 commit={'a' * 40}", False, AssertionError), + (f"git-ref-package@main commit={'a' * 40} dev_path=/foo/bar/", False, AssertionError), ], ) def test_spec_containing_commit_variant(spec_str, should_pass, error_type):