Add `--venv-system-site-packages` to ansible-test.

pull/66654/head
Matt Clay 5 years ago
parent 8f02022353
commit 934d6b235b

@ -0,0 +1,2 @@
minor_changes:
- "ansible-test - added a ``--venv-system-site-packages`` option for use with the ``--venv`` option"

@ -653,6 +653,12 @@ def add_environments(parser, isolated_delegation=True):
action='store_true',
help='run from ansible-test managed virtual environments')
venv = parser.add_argument_group(title='venv arguments')
venv.add_argument('--venv-system-site-packages',
action='store_true',
help='enable system site packages')
if not isolated_delegation:
environments.set_defaults(
docker=None,

@ -45,6 +45,7 @@ class EnvironmentConfig(CommonConfig):
self.local = args.local is True
self.venv = args.venv
self.venv_system_site_packages = args.venv_system_site_packages
self.python = args.python if 'python' in args else None # type: str

@ -167,14 +167,20 @@ def delegate_venv(args, # type: EnvironmentConfig
if needs_httptester:
display.warning('Use --docker or --remote to enable httptester for tests marked "needs/httptester": %s' % ', '.join(needs_httptester))
venvs = dict((version, os.path.join(ResultType.TMP.path, 'delegation', 'python%s' % version)) for version in versions)
venvs = dict((version, path) for version, path in venvs.items() if create_virtual_environment(args, version, path))
if args.venv_system_site_packages:
suffix = '-ssp'
else:
suffix = ''
venvs = dict((version, os.path.join(ResultType.TMP.path, 'delegation', 'python%s%s' % (version, suffix))) for version in versions)
venvs = dict((version, path) for version, path in venvs.items() if create_virtual_environment(args, version, path, args.venv_system_site_packages))
if not venvs:
raise ApplicationError('No usable virtual environment support found.')
options = {
'--venv': 0,
'--venv-system-site-packages': 0,
}
with tempdir() as inject_path:

Loading…
Cancel
Save