diff --git a/hacking/test-module b/hacking/test-module index 5e203170378..1eb9c912521 100755 --- a/hacking/test-module +++ b/hacking/test-module @@ -64,7 +64,8 @@ def parse(): help="path to python debugger (e.g. /usr/bin/pdb)") parser.add_option('-I', '--interpreter', dest='interpreter', help="path to interpreter to use for this module (e.g. ansible_python_interpreter=/usr/bin/python)", - metavar='INTERPRETER_TYPE=INTERPRETER_PATH') + metavar='INTERPRETER_TYPE=INTERPRETER_PATH', + default="ansible_python_interpreter=%s" % (sys.executable if sys.executable else '/usr/bin/python')) parser.add_option('-c', '--check', dest='check', action='store_true', help="run the module in check mode") parser.add_option('-n', '--noexecute', dest='execute', action='store_false', diff --git a/test/integration/targets/test_infra/runme.sh b/test/integration/targets/test_infra/runme.sh index 548d92f632b..9c86a5d3fd6 100755 --- a/test/integration/targets/test_infra/runme.sh +++ b/test/integration/targets/test_infra/runme.sh @@ -24,8 +24,12 @@ echo "$PB_OUT" | grep -F "assert works (True)" || exit 1 set -e -# ensure test-module script works well PING_MODULE_PATH="../../../../lib/ansible/modules/system/ping.py" + +# ensure test-module script works without passing Python interpreter path +../../../../hacking/test-module -m "$PING_MODULE_PATH" + +# ensure test-module script works well ../../../../hacking/test-module -m "$PING_MODULE_PATH" -I ansible_python_interpreter="$(which python)" # ensure module.ansible_version is defined when using test-module