From 379461283249df66231505d52fc099ef564b0911 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 21 Sep 2023 21:01:58 -0700 Subject: [PATCH] ansible-test - Skip pylint test on Python 3.12 (#81706) --- changelogs/fragments/ansible-test-pylint-python-3.12.yml | 2 ++ .../integration/targets/ansible-test-sanity-pylint/runme.sh | 5 +++++ test/lib/ansible_test/_internal/commands/sanity/pylint.py | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 changelogs/fragments/ansible-test-pylint-python-3.12.yml diff --git a/changelogs/fragments/ansible-test-pylint-python-3.12.yml b/changelogs/fragments/ansible-test-pylint-python-3.12.yml new file mode 100644 index 00000000000..3b28929037f --- /dev/null +++ b/changelogs/fragments/ansible-test-pylint-python-3.12.yml @@ -0,0 +1,2 @@ +known_issues: + - ansible-test - The ``pylint`` sanity test is not supported on Python 3.12. Use Python 3.10 or 3.11 instead. diff --git a/test/integration/targets/ansible-test-sanity-pylint/runme.sh b/test/integration/targets/ansible-test-sanity-pylint/runme.sh index 72190bfaa0f..386d16c6106 100755 --- a/test/integration/targets/ansible-test-sanity-pylint/runme.sh +++ b/test/integration/targets/ansible-test-sanity-pylint/runme.sh @@ -2,6 +2,11 @@ set -eu +if [ "${ANSIBLE_TEST_PYTHON_VERSION}" = "3.12" ]; then + echo "skipping test, pylint is not supported on Python 3.12" + exit +fi + source ../collection/setup.sh # Create test scenarios at runtime that do not pass sanity tests. diff --git a/test/lib/ansible_test/_internal/commands/sanity/pylint.py b/test/lib/ansible_test/_internal/commands/sanity/pylint.py index 54b1952f794..e78a65f4911 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/pylint.py +++ b/test/lib/ansible_test/_internal/commands/sanity/pylint.py @@ -82,6 +82,12 @@ class PylintTest(SanitySingleVersion): """Error code for ansible-test matching the format used by the underlying test program, or None if the program does not use error codes.""" return 'ansible-test' + @property + def supported_python_versions(self) -> t.Optional[tuple[str, ...]]: + """A tuple of supported Python versions or None if the test does not depend on specific Python versions.""" + # NOTE: When removing the Python 3.12 exclusion, be sure to update the ansible-test-sanity-pylint integration test. + return tuple(version for version in super().supported_python_versions if version != '3.12') + def filter_targets(self, targets: list[TestTarget]) -> list[TestTarget]: """Return the given list of test targets, filtered to include only those relevant for the test.""" return [target for target in targets if os.path.splitext(target.path)[1] == '.py' or is_subdir(target.path, 'bin')]