From abe8e4c9e8bd9cdca70a7906b15beb57a52393ca Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 18 Sep 2018 13:58:22 -0700 Subject: [PATCH] Run unit tests in parallel. (#45812) --- test/runner/lib/executor.py | 1 + test/units/conftest.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index ded10d0e95..f1bd56f5af 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -1156,6 +1156,7 @@ def command_units(args): 'pytest', '--boxed', '-r', 'a', + '-n', 'auto', '--color', 'yes' if args.color else 'no', '--junit-xml', diff --git a/test/units/conftest.py b/test/units/conftest.py index 2cd1f74596..c7163201d0 100644 --- a/test/units/conftest.py +++ b/test/units/conftest.py @@ -24,7 +24,15 @@ def pytest_configure(): coverage_instances.append(obj) if not coverage_instances: - return + coverage_config = os.environ.get('_ANSIBLE_COVERAGE_CONFIG') + + if not coverage_config: + return + + cov = coverage.Coverage(config_file=coverage_config) + coverage_instances.append(cov) + else: + cov = None os_exit = os._exit @@ -36,3 +44,6 @@ def pytest_configure(): os_exit(*args, **kwargs) os._exit = coverage_exit + + if cov: + cov.start()