From 6327a6114b2b0333f995646c74ba341c6798eac6 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 11 Jul 2019 14:38:50 -0700 Subject: [PATCH] Add ansible-test units --num-workers option. --- test/runner/lib/cli.py | 5 +++++ test/runner/lib/config.py | 1 + test/runner/lib/executor.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/cli.py b/test/runner/lib/cli.py index 745f915f9d6..9ce145d3aaf 100644 --- a/test/runner/lib/cli.py +++ b/test/runner/lib/cli.py @@ -382,6 +382,11 @@ def parse_args(): action='store_true', help='collect tests but do not execute them') + # noinspection PyTypeChecker + units.add_argument('--num-workers', + type=int, + help='number of workers to use (default: auto)') + units.add_argument('--requirements-mode', choices=('only', 'skip'), help=argparse.SUPPRESS) diff --git a/test/runner/lib/config.py b/test/runner/lib/config.py index b2596d16acc..e441d76a81f 100644 --- a/test/runner/lib/config.py +++ b/test/runner/lib/config.py @@ -261,6 +261,7 @@ class UnitsConfig(TestConfig): super(UnitsConfig, self).__init__(args, 'units') self.collect_only = args.collect_only # type: bool + self.num_workers = args.num_workers # type: int self.requirements_mode = args.requirements_mode if 'requirements_mode' in args else '' diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index fac134ae9d9..a6ae03fa55d 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -1331,7 +1331,7 @@ def command_units(args): 'pytest', '--boxed', '-r', 'a', - '-n', 'auto', + '-n', str(args.num_workers) if args.num_workers else 'auto', '--color', 'yes' if args.color else 'no', '--junit-xml',