Add a --no-pip-check option to ansible-test.

This commit is contained in:
Matt Clay 2020-01-27 17:19:42 -08:00
parent 0971a0e7bc
commit ee50792416
4 changed files with 19 additions and 8 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "ansible-test - added a ``--no-pip-check`` option"

View file

@ -643,6 +643,12 @@ def add_environments(parser, isolated_delegation=True):
default=None,
help='path to the docker or remote python interpreter')
parser.add_argument('--no-pip-check',
dest='pip_check',
default=True,
action='store_false',
help='do not run "pip check" to verify requirements')
environments = parser.add_mutually_exclusive_group()
environments.add_argument('--local',

View file

@ -80,6 +80,8 @@ class EnvironmentConfig(CommonConfig):
self.python_version = self.python or actual_major_minor
self.python_interpreter = args.python_interpreter
self.pip_check = args.pip_check
self.delegate = self.docker or self.remote or self.venv
self.delegate_args = [] # type: t.List[str]

View file

@ -237,14 +237,15 @@ def install_command_requirements(args, python_version=None):
raise ApplicationError('Conflicts detected in requirements. The following commands reported changes during verification:\n%s' %
'\n'.join((' '.join(cmd_quote(c) for c in cmd) for cmd in changes)))
# ask pip to check for conflicts between installed packages
try:
run_command(args, pip + ['check', '--disable-pip-version-check'], capture=True)
except SubprocessError as ex:
if ex.stderr.strip() == 'ERROR: unknown command "check"':
display.warning('Cannot check pip requirements for conflicts because "pip check" is not supported.')
else:
raise
if args.pip_check:
# ask pip to check for conflicts between installed packages
try:
run_command(args, pip + ['check', '--disable-pip-version-check'], capture=True)
except SubprocessError as ex:
if ex.stderr.strip() == 'ERROR: unknown command "check"':
display.warning('Cannot check pip requirements for conflicts because "pip check" is not supported.')
else:
raise
def run_pip_commands(args, pip, commands, detect_pip_changes=False):