Allow Python 3.11
This commit is contained in:
parent
0b450a5a8f
commit
c175ef7d47
61
allow-python3.11.patch
Normal file
61
allow-python3.11.patch
Normal file
@ -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'
|
@ -22,6 +22,11 @@ Patch: https://github.com/ansible/ansible/pull/76670.patch#/fix-tests-failing-o
|
||||
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/77835.patch#/avoid-deprecated-method-unit-tests.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
|
||||
|
Loading…
Reference in New Issue
Block a user