1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add --tox-sitepackages option to ansible-test.

This commit is contained in:
Matt Clay 2016-12-13 16:25:16 -08:00
parent dd46cb7b05
commit f28b5a0ed8
3 changed files with 16 additions and 1 deletions

View file

@ -70,10 +70,17 @@ def delegate_tox(args, exclude, require):
options = { options = {
'--tox': args.tox_args, '--tox': args.tox_args,
'--tox-sitepackages': 0,
} }
for version in versions: 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) cmd = generate_command(args, os.path.abspath('test/runner/test.py'), options, exclude, require)
if not args.python: if not args.python:

View file

@ -1104,6 +1104,8 @@ class EnvironmentConfig(CommonConfig):
self.docker_privileged = args.docker_privileged if 'docker_privileged' in args else False # type: bool 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.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.remote_stage = args.remote_stage # type: str
self.requirements = args.requirements # type: bool self.requirements = args.requirements # type: bool

View file

@ -387,6 +387,12 @@ def add_environments(parser, tox_version=False, tox_only=False):
action='store_true', action='store_true',
help='run from a tox virtualenv') 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: if tox_only:
environments.set_defaults( environments.set_defaults(
docker=None, docker=None,