cmd/__init__.py: pass tests in case n=1 (#48417)

This commit is contained in:
Harmen Stoppels 2025-01-06 15:30:29 +01:00 committed by Harmen Stoppels
parent 734ada1f10
commit b621c045a7
2 changed files with 16 additions and 11 deletions

View File

@ -167,7 +167,9 @@ def quote_kvp(string: str) -> str:
def parse_specs(
args: Union[str, List[str]], concretize: bool = False, tests: bool = False
args: Union[str, List[str]],
concretize: bool = False,
tests: spack.concretize.TestsType = False,
) -> List[spack.spec.Spec]:
"""Convenience function for parsing arguments from specs. Handles common
exceptions and dies if there are errors.
@ -179,11 +181,13 @@ def parse_specs(
if not concretize:
return specs
to_concretize = [(s, None) for s in specs]
to_concretize: List[spack.concretize.SpecPairInput] = [(s, None) for s in specs]
return _concretize_spec_pairs(to_concretize, tests=tests)
def _concretize_spec_pairs(to_concretize, tests=False):
def _concretize_spec_pairs(
to_concretize: List[spack.concretize.SpecPairInput], tests: spack.concretize.TestsType = False
) -> List[spack.spec.Spec]:
"""Helper method that concretizes abstract specs from a list of abstract,concrete pairs.
Any spec with a concrete spec associated with it will concretize to that spec. Any spec
@ -194,7 +198,7 @@ def _concretize_spec_pairs(to_concretize, tests=False):
# Special case for concretizing a single spec
if len(to_concretize) == 1:
abstract, concrete = to_concretize[0]
return [concrete or abstract.concretized()]
return [concrete or abstract.concretized(tests=tests)]
# Special case if every spec is either concrete or has an abstract hash
if all(

View File

@ -6,7 +6,7 @@
import sys
import time
from contextlib import contextmanager
from typing import Iterable, Optional, Sequence, Tuple, Union
from typing import Iterable, List, Optional, Sequence, Tuple, Union
import llnl.util.tty as tty
@ -36,6 +36,7 @@ def enable_compiler_existence_check():
CHECK_COMPILER_EXISTENCE = saved
SpecPairInput = Tuple[Spec, Optional[Spec]]
SpecPair = Tuple[Spec, Spec]
SpecLike = Union[Spec, str]
TestsType = Union[bool, Iterable[str]]
@ -60,8 +61,8 @@ def concretize_specs_together(
def concretize_together(
spec_list: Sequence[SpecPair], tests: TestsType = False
) -> Sequence[SpecPair]:
spec_list: Sequence[SpecPairInput], tests: TestsType = False
) -> List[SpecPair]:
"""Given a number of specs as input, tries to concretize them together.
Args:
@ -77,8 +78,8 @@ def concretize_together(
def concretize_together_when_possible(
spec_list: Sequence[SpecPair], tests: TestsType = False
) -> Sequence[SpecPair]:
spec_list: Sequence[SpecPairInput], tests: TestsType = False
) -> List[SpecPair]:
"""Given a number of specs as input, tries to concretize them together to the extent possible.
See documentation for ``unify: when_possible`` concretization for the precise definition of
@ -114,8 +115,8 @@ def concretize_together_when_possible(
def concretize_separately(
spec_list: Sequence[SpecPair], tests: TestsType = False
) -> Sequence[SpecPair]:
spec_list: Sequence[SpecPairInput], tests: TestsType = False
) -> List[SpecPair]:
"""Concretizes the input specs separately from each other.
Args: