ansible-core/support-Python-3.12-in-ansible-test.patch

152 lines
6.9 KiB
Diff

From c10e3d21fcb54dd0a9dfe44d97355195166510a9 Mon Sep 17 00:00:00 2001
From: s-hertel <19572925+s-hertel@users.noreply.github.com>
Date: Tue, 16 May 2023 13:48:12 -0400
Subject: [PATCH] add Python 3.12 support to ansible-test
skip docs build sanity test on Python 3.12 until aiohttp has a compatible version
skip Python 3.12 tests on windows/networking until the default container is
updated
add interpreter fallback?
---
lib/ansible/config/base.yml | 1 +
setup.cfg | 1 +
.../minimum-build-constraints.txt | 4 +++-
test/lib/ansible_test/_data/requirements/ansible-test.txt | 2 +-
test/lib/ansible_test/_internal/bootstrap.py | 4 ++++
test/lib/ansible_test/_internal/coverage_util.py | 2 +-
test/lib/ansible_test/_internal/python_requirements.py | 4 ++--
test/lib/ansible_test/_util/target/common/constants.py | 1 +
test/lib/ansible_test/_util/target/setup/bootstrap.sh | 2 +-
test/sanity/code-smell/docs-build.json | 1 +
10 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml
index 206deb76d2e916..469fbc6846b6d9 100644
--- a/lib/ansible/config/base.yml
+++ b/lib/ansible/config/base.yml
@@ -1557,6 +1557,7 @@ _INTERPRETER_PYTHON_DISTRO_MAP:
INTERPRETER_PYTHON_FALLBACK:
name: Ordered list of Python interpreters to check for in discovery
default:
+ - python3.12
- python3.11
- python3.10
- python3.9
diff --git a/setup.cfg b/setup.cfg
index e020ee3b15caea..af79337f91e9de 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,6 +30,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
+ Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
Topic :: System :: Installation/Setup
Topic :: System :: Systems Administration
diff --git a/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt b/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
index 3ba47aeb4b69b4..765ca85c17d8d3 100644
--- a/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
+++ b/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
@@ -2,8 +2,10 @@
setuptools == 57.0.0; python_version == "3.9" or python_version == "3.10"
# Lowest supporting Python 3.11:
-setuptools == 60.0.0; python_version >= "3.11"
+setuptools == 60.0.0; python_version == "3.11"
+# Lowest supporting Python 3.12:
+setuptools == 66.1.0; python_version >= "3.12"
# An arbitrary old version that was released before Python 3.9.0:
wheel == 0.33.6
diff --git a/test/lib/ansible_test/_data/requirements/ansible-test.txt b/test/lib/ansible_test/_data/requirements/ansible-test.txt
index f7cb9c27780856..8b1772fb915bc3 100644
--- a/test/lib/ansible_test/_data/requirements/ansible-test.txt
+++ b/test/lib/ansible_test/_data/requirements/ansible-test.txt
@@ -1,4 +1,4 @@
# The test-constraints sanity test verifies this file, but changes must be made manually to keep it in up-to-date.
virtualenv == 16.7.12 ; python_version < '3'
-coverage == 6.5.0 ; python_version >= '3.7' and python_version <= '3.11'
+coverage == 6.5.0 ; python_version >= '3.7' and python_version <= '3.12'
coverage == 4.5.4 ; python_version >= '2.6' and python_version <= '3.6'
diff --git a/test/lib/ansible_test/_internal/bootstrap.py b/test/lib/ansible_test/_internal/bootstrap.py
index b0cfb601d94497..1bd357679bb72c 100644
--- a/test/lib/ansible_test/_internal/bootstrap.py
+++ b/test/lib/ansible_test/_internal/bootstrap.py
@@ -90,6 +90,10 @@ def get_variables(self) -> dict[str, t.Union[str, list[str]]]:
"""The variables to template in the bootstrapping script."""
variables = super().get_variables()
+ # remove once the default docker container is updated
+ if self.platform in ('ios', 'vyos', 'windows'):
+ variables['python_versions'] = [version for version in self.python_versions if version != '3.12']
+
variables.update(
platform=self.platform,
platform_version=self.platform_version,
diff --git a/test/lib/ansible_test/_internal/coverage_util.py b/test/lib/ansible_test/_internal/coverage_util.py
index 0af1cac4e97c63..f9276d323c50fc 100644
--- a/test/lib/ansible_test/_internal/coverage_util.py
+++ b/test/lib/ansible_test/_internal/coverage_util.py
@@ -69,7 +69,7 @@ class CoverageVersion:
COVERAGE_VERSIONS = (
# IMPORTANT: Keep this in sync with the ansible-test.txt requirements file.
- CoverageVersion('6.5.0', 7, (3, 7), (3, 11)),
+ CoverageVersion('6.5.0', 7, (3, 7), (3, 12)),
CoverageVersion('4.5.4', 0, (2, 6), (3, 6)),
)
"""
diff --git a/test/lib/ansible_test/_internal/python_requirements.py b/test/lib/ansible_test/_internal/python_requirements.py
index fc88b637c2b242..1a07334d8637c5 100644
--- a/test/lib/ansible_test/_internal/python_requirements.py
+++ b/test/lib/ansible_test/_internal/python_requirements.py
@@ -434,8 +434,8 @@ def get_venv_packages(python: PythonConfig) -> dict[str, str]:
# See: https://github.com/ansible/base-test-container/blob/main/files/installer.py
default_packages = dict(
- pip='21.3.1',
- setuptools='60.8.2',
+ pip='23.1.2',
+ setuptools='67.7.2',
wheel='0.37.1',
)
diff --git a/test/lib/ansible_test/_util/target/common/constants.py b/test/lib/ansible_test/_util/target/common/constants.py
index 9bddfaf439563e..f3c3857ef97dbf 100644
--- a/test/lib/ansible_test/_util/target/common/constants.py
+++ b/test/lib/ansible_test/_util/target/common/constants.py
@@ -17,4 +17,5 @@
'3.9',
'3.10',
'3.11',
+ '3.12',
)
diff --git a/test/lib/ansible_test/_util/target/setup/bootstrap.sh b/test/lib/ansible_test/_util/target/setup/bootstrap.sh
index ea17dad38751cc..367dcfcb4ce17e 100644
--- a/test/lib/ansible_test/_util/target/setup/bootstrap.sh
+++ b/test/lib/ansible_test/_util/target/setup/bootstrap.sh
@@ -53,7 +53,7 @@ install_pip() {
pip_bootstrap_url="https://ci-files.testing.ansible.com/ansible-test/get-pip-20.3.4.py"
;;
*)
- pip_bootstrap_url="https://ci-files.testing.ansible.com/ansible-test/get-pip-21.3.1.py"
+ pip_bootstrap_url="https://ci-files.testing.ansible.com/ansible-test/get-pip-23.1.2.py"
;;
esac
diff --git a/test/sanity/code-smell/docs-build.json b/test/sanity/code-smell/docs-build.json
index a43fa923b2b002..eedeca35dcba20 100644
--- a/test/sanity/code-smell/docs-build.json
+++ b/test/sanity/code-smell/docs-build.json
@@ -1,5 +1,6 @@
{
"disabled": true,
+ "maximum_python_version": "3.11",
"no_targets": true,
"output": "path-line-column-message"
}