diff --git a/tests/README.md b/tests/README.md index ed54b0b8221fb2954721c807a13fef6ce4ec4a16..1e9d4e4a194d47b99e2fa94d02202678d3765288 100644 --- a/tests/README.md +++ b/tests/README.md @@ -36,6 +36,12 @@ environment variable. For example: IPA_SSH_PASSWORD=<ipaserver_ssh_password> IPA_SERVER_HOST=<ipaserver_host_or_ip> pytest ``` +If you want, or need to to set the Python interpreter to use, you must set `IPA_PYTHON_PATH` +environment variable. For example: + +``` +IPA_PYTHON_PATH=/usr/bin/python3.14 IPA_SERVER_HOST=<ipaserver_host_or_ip> pytest +``` To run a single test use the full path with the following format: diff --git a/tests/utils.py b/tests/utils.py index 01991aaae61e5455f9e13a8ad509e1391c38fea3..89a24fc4956a64b88e8291971d7a191cf99ba64d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -43,6 +43,10 @@ def get_ssh_password(): return os.getenv("IPA_SSH_PASSWORD") +def get_python_interpreter(): + return os.getenv("IPA_PYTHON_PATH") + + def get_server_host(): return os.getenv("IPA_SERVER_HOST") @@ -97,6 +101,12 @@ def get_inventory_content(): if sshpass: ipa_server_host += " ansible_ssh_pass=%s" % sshpass + python_interpreter = get_python_interpreter() + if python_interpreter: + ipa_server_host += ( + " ansible_python_interpreter=%s" % python_interpreter + ) + lines = [ "[ipaserver]", ipa_server_host,