Add more ansible-test args to delegation config.
This commit is contained in:
parent
ee50792416
commit
efd2dd8929
3 changed files with 37 additions and 0 deletions
2
changelogs/fragments/ansible-test-delegation-options.yml
Normal file
2
changelogs/fragments/ansible-test-delegation-options.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- "ansible-test - allow delegation config to specify equivalents to the ``--no-pip-check``, ``--disable-httptester`` and `--no-temp-unicode`` options"
|
|
@ -13,6 +13,7 @@ from .util import (
|
|||
find_python,
|
||||
generate_pip_command,
|
||||
get_docker_completion,
|
||||
get_remote_completion,
|
||||
ApplicationError,
|
||||
)
|
||||
|
||||
|
@ -91,6 +92,12 @@ class EnvironmentConfig(CommonConfig):
|
|||
self.inject_httptester = args.inject_httptester if 'inject_httptester' in args else False # type: bool
|
||||
self.httptester = docker_qualify_image(args.httptester if 'httptester' in args else '') # type: str
|
||||
|
||||
if self.get_delegated_completion().get('httptester', 'enabled') == 'disabled':
|
||||
self.httptester = False
|
||||
|
||||
if self.get_delegated_completion().get('pip-check', 'enabled') == 'disabled':
|
||||
self.pip_check = False
|
||||
|
||||
if args.check_python and args.check_python != actual_major_minor:
|
||||
raise ApplicationError('Running under Python %s instead of Python %s as expected.' % (actual_major_minor, args.check_python))
|
||||
|
||||
|
@ -117,6 +124,18 @@ class EnvironmentConfig(CommonConfig):
|
|||
"""
|
||||
return generate_pip_command(self.python_executable)
|
||||
|
||||
def get_delegated_completion(self):
|
||||
"""Returns a dictionary of settings specific to the selected delegation system, if any. Otherwise returns an empty dictionary.
|
||||
:rtype: dict[str, str]
|
||||
"""
|
||||
if self.docker:
|
||||
return get_docker_completion().get(self.docker_raw, {})
|
||||
|
||||
if self.remote:
|
||||
return get_remote_completion().get(self.remote, {})
|
||||
|
||||
return {}
|
||||
|
||||
|
||||
class TestConfig(EnvironmentConfig):
|
||||
"""Configuration common to all test commands."""
|
||||
|
@ -236,6 +255,9 @@ class IntegrationConfig(TestConfig):
|
|||
self.no_temp_workdir = args.no_temp_workdir
|
||||
self.no_temp_unicode = args.no_temp_unicode
|
||||
|
||||
if self.get_delegated_completion().get('temp-unicode', 'enabled') == 'disabled':
|
||||
self.no_temp_unicode = True
|
||||
|
||||
if self.list_targets:
|
||||
self.explain = True
|
||||
|
||||
|
|
|
@ -575,6 +575,12 @@ def filter_options(args, argv, options, exclude, require):
|
|||
'--base-branch': 1,
|
||||
})
|
||||
|
||||
if isinstance(args, IntegrationConfig):
|
||||
options.update({
|
||||
'--no-temp-unicode': 0,
|
||||
'--no-pip-check': 0,
|
||||
})
|
||||
|
||||
if isinstance(args, (NetworkIntegrationConfig, WindowsIntegrationConfig)):
|
||||
options.update({
|
||||
'--inventory': 1,
|
||||
|
@ -621,3 +627,10 @@ def filter_options(args, argv, options, exclude, require):
|
|||
yield '--redact'
|
||||
else:
|
||||
yield '--no-redact'
|
||||
|
||||
if isinstance(args, IntegrationConfig):
|
||||
if args.no_temp_unicode:
|
||||
yield '--no-temp-unicode'
|
||||
|
||||
if not args.pip_check:
|
||||
yield '--no-pip-check'
|
||||
|
|
Loading…
Reference in a new issue