diff --git a/allow-python3.11.patch b/allow-python3.11.patch new file mode 100644 index 0000000..3fdf2f9 --- /dev/null +++ b/allow-python3.11.patch @@ -0,0 +1,61 @@ +diff --git a/test/lib/ansible_test/_util/target/common/constants.py b/test/lib/ansible_test/_util/target/common/constants.py +index fdaa9e5..e1136cc 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 @@ CONTROLLER_PYTHON_VERSIONS = ( + '3.8', + '3.9', + '3.10', ++ '3.11', + ) +diff --git a/test/units/module_utils/urls/test_RedirectHandlerFactory.py b/test/units/module_utils/urls/test_RedirectHandlerFactory.py +index aa3500a..7bbe4b5 100644 +--- a/test/units/module_utils/urls/test_RedirectHandlerFactory.py ++++ b/test/units/module_utils/urls/test_RedirectHandlerFactory.py +@@ -130,9 +130,11 @@ def test_redir_validate_certs(urllib_req, request_body, mocker): + assert opener_mock.add_handler.call_count == int(not HAS_SSLCONTEXT) + + +-def test_redir_http_error_308_urllib2(urllib_req, request_body): ++def test_redir_http_error_308_urllib2(urllib_req, request_body, mocker): ++ redir_mock = mocker.patch.object(urllib_request.HTTPRedirectHandler, 'redirect_request') + handler = RedirectHandlerFactory('urllib2', False) + inst = handler() + +- with pytest.raises(urllib_error.HTTPError): +- inst.redirect_request(urllib_req, request_body, 308, '308 Permanent Redirect', {}, 'https://docs.ansible.com/') ++ inst.redirect_request(urllib_req, request_body, 308, '308 Permanent Redirect', {}, 'https://docs.ansible.com/') ++ ++ assert redir_mock.call_count == 1 +diff --git a/test/units/module_utils/urls/test_fetch_url.py b/test/units/module_utils/urls/test_fetch_url.py +index 4869bb0..94f2e1b 100644 +--- a/test/units/module_utils/urls/test_fetch_url.py ++++ b/test/units/module_utils/urls/test_fetch_url.py +@@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type + + import socket ++import sys + + from ansible.module_utils.six import StringIO + from ansible.module_utils.six.moves.http_cookiejar import Cookie +@@ -133,9 +134,16 @@ def test_fetch_url_cookies(mocker, fake_ansible_module): + r, info = fetch_url(fake_ansible_module, 'http://ansible.com/') + + assert info['cookies'] == {'Baz': 'qux', 'Foo': 'bar'} +- # Python sorts cookies in order of most specific (ie. longest) path first +- # items with the same path are reversed from response order +- assert info['cookies_string'] == 'Baz=qux; Foo=bar' ++ ++ if sys.version_info < (3, 11): ++ # Python sorts cookies in order of most specific (ie. longest) path first ++ # items with the same path are reversed from response order ++ assert info['cookies_string'] == 'Baz=qux; Foo=bar' ++ else: ++ # Python 3.11 and later preserve the Set-Cookie order. ++ # See: https://github.com/python/cpython/pull/22745/ ++ assert info['cookies_string'] == 'Foo=bar; Baz=qux' ++ + # The key here has a `-` as opposed to what we see in the `uri` module that converts to `_` + # Note: this is response order, which differs from cookies_string + assert info['set-cookie'] == 'Foo=bar, Baz=qux' diff --git a/ansible-core.spec b/ansible-core.spec index eac2c81..ed65008 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -20,11 +20,14 @@ Release: 1%{?dist} # SPDX-License-Identifier: GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0 License: GPLv3+ and BSD and Python and MIT and ASL 2.0 Source: https://github.com/ansible/ansible/archive/v%{version}/%{name}-%{version}.tar.gz + # A 2.10.3 async test uses /usr/bin/python, which we do not have by default. # Patch the test to use /usr/bin/python3 as we have for our build. Patch: 2.10.3-test-patch.patch + # Stop using a deprecated cryptography method that is no longer available in F37. Patch: https://github.com/ansible/ansible/pull/77834.patch#/avoid-deprecated-method-unit-tests.patch + # These patches remove the requirement on python3-mock which is deprecated in Fedora. # They should be part of the next release Patch: https://github.com/ansible/ansible/commit/47e1cc38fdb656d359e9cbb8a10053997b8f68ba.patch @@ -33,6 +36,12 @@ Patch: https://github.com/ansible/ansible/pull/77952.patch # This has been modified locally to fix a bug. Patch: https://github.com/ansible/ansible/pull/77961.patch +# Allow Python 3.11 +# https://github.com/ansible/ansible/commit/dfde4be444ee66a1a0e44751b80bcf1afd6661d7 +# https://github.com/ansible/ansible/commit/0ef5274a3c6189e8fa6a7d97993c165ab548fe95 +# https://github.com/ansible/ansible/commit/8ca28acd0d121c778aa540c1d61f58f5ae2d5dcc +Patch: allow-python3.11.patch + Url: https://ansible.com BuildArch: noarch @@ -241,7 +250,7 @@ make PYTHON=%{python3} tests-py3 %endif %changelog -* Fri May 27 2022 Maxwell G - 2.13.0-1 +* Thu Jun 16 2022 Maxwell G - 2.13.0-1 - Update to 2.13.0. - Re-enable tests that work with newer pytest - Patch out python3-mock @@ -252,6 +261,9 @@ make PYTHON=%{python3} tests-py3 - Correct licensing - Generate shell completions +* Thu Jun 16 2022 Python Maint - 2.12.6-2 +- Rebuilt for Python 3.11 + * Tue May 24 2022 Maxwell G - 2.12.6-1 - Update to 2.12.6.