diff --git a/test/runner/injector/injector.py b/test/runner/injector/injector.py index 3bb9b9c22f3..a7f107b0645 100755 --- a/test/runner/injector/injector.py +++ b/test/runner/injector/injector.py @@ -105,6 +105,8 @@ def main(): if os.path.basename(__file__) == 'injector.py': args, env = runner() # code coverage collection is baked into the AnsiballZ wrapper when needed + elif os.path.basename(__file__) == 'python.py': + args, env = python() # run arbitrary python commands using the correct python and with optional code coverage else: args, env = injector() @@ -119,6 +121,20 @@ def main(): raise +def python(): + """ + :rtype: list[str], dict[str, str] + """ + if config.coverage_file: + args, env = coverage_command() + else: + args, env = [config.python_interpreter], os.environ.copy() + + args += config.arguments[1:] + + return args, env + + def injector(): """ :rtype: list[str], dict[str, str] diff --git a/test/runner/injector/python.py b/test/runner/injector/python.py new file mode 120000 index 00000000000..1f9d09cbf2a --- /dev/null +++ b/test/runner/injector/python.py @@ -0,0 +1 @@ +injector.py \ No newline at end of file