mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix ansible-test invocation of pytest.
This commit is contained in:
parent
f0535bac80
commit
1939f6c412
1 changed files with 10 additions and 2 deletions
|
@ -151,14 +151,22 @@ def injector():
|
||||||
:rtype: list[str], dict[str, str]
|
:rtype: list[str], dict[str, str]
|
||||||
"""
|
"""
|
||||||
command = os.path.basename(__file__)
|
command = os.path.basename(__file__)
|
||||||
executable = find_executable(command)
|
|
||||||
|
run_as_python_module = (
|
||||||
|
'pytest',
|
||||||
|
)
|
||||||
|
|
||||||
|
if command in run_as_python_module:
|
||||||
|
executable_args = ['-m', command]
|
||||||
|
else:
|
||||||
|
executable_args = [find_executable(command)]
|
||||||
|
|
||||||
if config.coverage_file:
|
if config.coverage_file:
|
||||||
args, env = coverage_command()
|
args, env = coverage_command()
|
||||||
else:
|
else:
|
||||||
args, env = [config.python_interpreter], os.environ.copy()
|
args, env = [config.python_interpreter], os.environ.copy()
|
||||||
|
|
||||||
args += [executable]
|
args += executable_args
|
||||||
|
|
||||||
if command in ('ansible', 'ansible-playbook', 'ansible-pull'):
|
if command in ('ansible', 'ansible-playbook', 'ansible-pull'):
|
||||||
if config.remote_interpreter is None:
|
if config.remote_interpreter is None:
|
||||||
|
|
Loading…
Reference in a new issue