You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/lib/ansible_test/_internal/cli/commands/units.py

66 lines
1.4 KiB
Python

"""Command line parsing for the `units` command."""
from __future__ import annotations
import argparse
from ...config import (
UnitsConfig,
)
from ...commands.units import (
command_units,
)
from ...target import (
walk_units_targets,
)
from ..environments import (
CompositeActionCompletionFinder,
ControllerMode,
TargetMode,
add_environments,
)
def do_units(
subparsers,
parent, # type: argparse.ArgumentParser
completer, # type: CompositeActionCompletionFinder
):
"""Command line parsing for the `units` command."""
parser = subparsers.add_parser(
'units',
parents=[parent],
help='unit tests',
) # type: argparse.ArgumentParser
parser.set_defaults(
func=command_units,
targets_func=walk_units_targets,
config=UnitsConfig,
)
units = parser.add_argument_group(title='unit test arguments')
units.add_argument(
'--collect-only',
action='store_true',
help='collect tests but do not execute them',
)
units.add_argument(
'--num-workers',
metavar='INT',
type=int,
help='number of workers to use (default: auto)',
)
units.add_argument(
'--requirements-mode',
choices=('only', 'skip'),
help=argparse.SUPPRESS,
)
add_environments(parser, completer, ControllerMode.DELEGATED, TargetMode.UNITS) # units