From 7b21457d588637d337005a09236f6d886658c0ca Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 20 Feb 2023 17:55:04 -0800 Subject: [stable-2.14] ansible-test - Show Python version before install (#80022) Always indicate the Python version being used before installing requirements. (cherry picked from commit 5e3db6e44169aa88cd027f469eea96f1f17fea95) Co-authored-by: Matt Clay --- .../fragments/ansible-test-requirements-message.yml | 3 +++ test/lib/ansible_test/_internal/python_requirements.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 changelogs/fragments/ansible-test-requirements-message.yml diff --git a/changelogs/fragments/ansible-test-requirements-message.yml b/changelogs/fragments/ansible-test-requirements-message.yml new file mode 100644 index 0000000000..864567be6a --- /dev/null +++ b/changelogs/fragments/ansible-test-requirements-message.yml @@ -0,0 +1,3 @@ +bugfixes: + - ansible-test - Always indicate the Python version being used before installing requirements. + Resolves issue https://github.com/ansible/ansible/issues/72855 diff --git a/test/lib/ansible_test/_internal/python_requirements.py b/test/lib/ansible_test/_internal/python_requirements.py index 0e133f913f..fc88b637c2 100644 --- a/test/lib/ansible_test/_internal/python_requirements.py +++ b/test/lib/ansible_test/_internal/python_requirements.py @@ -48,6 +48,7 @@ from .data import ( from .host_configs import ( PosixConfig, PythonConfig, + VirtualPythonConfig, ) from .connections import ( @@ -265,6 +266,20 @@ def run_pip( connection = connection or LocalConnection(args) script = prepare_pip_script(commands) + if isinstance(args, IntegrationConfig): + # Integration tests can involve two hosts (controller and target). + # The connection type can be used to disambiguate between the two. + context = " (controller)" if isinstance(connection, LocalConnection) else " (target)" + else: + context = "" + + if isinstance(python, VirtualPythonConfig): + context += " [venv]" + + # The interpreter path is not included below. + # It can be seen by running ansible-test with increased verbosity (showing all commands executed). + display.info(f'Installing requirements for Python {python.version}{context}') + if not args.explain: try: connection.run([python.path], data=script, capture=False) -- cgit v1.2.1