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):