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 GitHub
parent 0e6e61b32f
commit 4b4be2e2c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 11 deletions

View File

@ -171,7 +171,9 @@ def quote_kvp(string: str) -> str:
def parse_specs( 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]: ) -> List[spack.spec.Spec]:
"""Convenience function for parsing arguments from specs. Handles common """Convenience function for parsing arguments from specs. Handles common
exceptions and dies if there are errors. exceptions and dies if there are errors.
@ -183,11 +185,13 @@ def parse_specs(
if not concretize: if not concretize:
return specs 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) 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. """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 Any spec with a concrete spec associated with it will concretize to that spec. Any spec
@ -198,7 +202,7 @@ def _concretize_spec_pairs(to_concretize, tests=False):
# Special case for concretizing a single spec # Special case for concretizing a single spec
if len(to_concretize) == 1: if len(to_concretize) == 1:
abstract, concrete = to_concretize[0] 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 # Special case if every spec is either concrete or has an abstract hash
if all( if all(

View File

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