From f28b5a0ed86d9b007744b7815cb2ca4a283275f4 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 13 Dec 2016 16:25:16 -0800 Subject: [PATCH] Add --tox-sitepackages option to ansible-test. --- test/runner/lib/delegation.py | 9 ++++++++- test/runner/lib/executor.py | 2 ++ test/runner/test.py | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/delegation.py b/test/runner/lib/delegation.py index 88dcf9b7fe..8cd1642655 100644 --- a/test/runner/lib/delegation.py +++ b/test/runner/lib/delegation.py @@ -70,10 +70,17 @@ def delegate_tox(args, exclude, require): options = { '--tox': args.tox_args, + '--tox-sitepackages': 0, } for version in versions: - tox = ['tox', '-c', 'test/runner/tox.ini', '-e', 'py' + version.replace('.', ''), '--'] + tox = ['tox', '-c', 'test/runner/tox.ini', '-e', 'py' + version.replace('.', '')] + + if args.tox_sitepackages: + tox.append('--sitepackages') + + tox.append('--') + cmd = generate_command(args, os.path.abspath('test/runner/test.py'), options, exclude, require) if not args.python: diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index e48224cb9d..80a8ce225c 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -1104,6 +1104,8 @@ class EnvironmentConfig(CommonConfig): self.docker_privileged = args.docker_privileged if 'docker_privileged' in args else False # type: bool self.docker_util = docker_qualify_image(args.docker_util if 'docker_util' in args else None) # type: str | None + self.tox_sitepackages = args.tox_sitepackages # type: bool + self.remote_stage = args.remote_stage # type: str self.requirements = args.requirements # type: bool diff --git a/test/runner/test.py b/test/runner/test.py index b9589b6c35..810adff7c3 100755 --- a/test/runner/test.py +++ b/test/runner/test.py @@ -387,6 +387,12 @@ def add_environments(parser, tox_version=False, tox_only=False): action='store_true', help='run from a tox virtualenv') + tox = parser.add_argument_group(title='tox arguments') + + tox.add_argument('--tox-sitepackages', + action='store_true', + help='allow access to globally installed packages') + if tox_only: environments.set_defaults( docker=None,