From 906c969b551b346ef54a2c0b41e04f632b7b73c2 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 15 Jul 2024 09:37:40 -0700 Subject: [PATCH] ansible-test - Improve unknown env error message (#83610) --- .../fragments/ansible-test-error-message-improvement.yml | 2 ++ test/lib/ansible_test/_internal/cli/compat.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/ansible-test-error-message-improvement.yml diff --git a/changelogs/fragments/ansible-test-error-message-improvement.yml b/changelogs/fragments/ansible-test-error-message-improvement.yml new file mode 100644 index 00000000000..a07a255ac23 --- /dev/null +++ b/changelogs/fragments/ansible-test-error-message-improvement.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Improve the error message shown when an unknown ``--remote`` or ``--docker`` option is given. diff --git a/test/lib/ansible_test/_internal/cli/compat.py b/test/lib/ansible_test/_internal/cli/compat.py index 19996faf31f..27267f48ac1 100644 --- a/test/lib/ansible_test/_internal/cli/compat.py +++ b/test/lib/ansible_test/_internal/cli/compat.py @@ -93,7 +93,10 @@ class PythonVersionUnspecifiedError(ApplicationError): """A Python version was not specified for a context which is unknown, thus the Python version is unknown.""" def __init__(self, context: str) -> None: - super().__init__(f'A Python version was not specified for environment `{context}`. Use the `--python` option to specify a Python version.') + super().__init__( + f'Environment `{context}` is unknown. Use a predefined environment instead. ' + f'Alternatively, to use an unknown environment, use the `--python` option to specify a Python version.' + ) class ControllerNotSupportedError(ApplicationError):