Commit 33b82936 authored by Jens Vagelpohl's avatar Jens Vagelpohl Committed by GitHub

Merge pull request #189 from zopefoundation/py310

Python 3.10 support
parents 8d687bbd 2c17b942
...@@ -28,6 +28,9 @@ jobs: ...@@ -28,6 +28,9 @@ jobs:
- ["3.9", "py39"] - ["3.9", "py39"]
- ["3.9", "py39-msgpack1"] - ["3.9", "py39-msgpack1"]
- ["3.9", "py39-uvloop"] - ["3.9", "py39-uvloop"]
- ["3.10", "py310"]
- ["3.10", "py310-msgpack1"]
- ["3.10", "py310-uvloop"]
- ["pypy2", "pypy"] - ["pypy2", "pypy"]
- ["pypy3", "pypy3"] - ["pypy3", "pypy3"]
- ["pypy3", "pypy3-msgpack1"] - ["pypy3", "pypy3-msgpack1"]
......
Changelog Changelog
========= =========
5.3.1 (unreleased) 5.4.0 (unreleased)
------------------ ------------------
- Add support for Python 3.10.
- Add ``ConflictError`` to the list of unlogged server exceptions - Add ``ConflictError`` to the list of unlogged server exceptions
(the client/its application should determine whether it wants (the client/its application should determine whether it wants
them logged). them logged).
...@@ -20,7 +22,6 @@ Changelog ...@@ -20,7 +22,6 @@ Changelog
See `issue 156 <https://github.com/zopefoundation/ZEO/issues/156>`_. See `issue 156 <https://github.com/zopefoundation/ZEO/issues/156>`_.
5.3.0 (2022-03-24) 5.3.0 (2022-03-24)
------------------ ------------------
......
...@@ -50,6 +50,7 @@ Programming Language :: Python :: 3.6 ...@@ -50,6 +50,7 @@ Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy Programming Language :: Python :: Implementation :: PyPy
Topic :: Database Topic :: Database
......
...@@ -133,14 +133,17 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -133,14 +133,17 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
server.close() server.close()
def assert_context( def assert_context(
self, factory, context, self,
server,
factory, context,
cert=(server_cert, server_key, None), cert=(server_cert, server_key, None),
verify_mode=ssl.CERT_REQUIRED, verify_mode=ssl.CERT_REQUIRED,
check_hostname=False, check_hostname=False,
cafile=None, capath=None, cafile=None, capath=None,
): ):
factory.assert_called_with( factory.assert_called_with(
ssl.Purpose.CLIENT_AUTH, cafile=cafile, capath=capath) ssl.Purpose.CLIENT_AUTH if server else ssl.Purpose.SERVER_AUTH,
cafile=cafile, capath=capath)
context.load_cert_chain.assert_called_with(*cert) context.load_cert_chain.assert_called_with(*cert)
self.assertEqual(context, factory.return_value) self.assertEqual(context, factory.return_value)
self.assertEqual(context.verify_mode, verify_mode) self.assertEqual(context.verify_mode, verify_mode)
...@@ -157,7 +160,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -157,7 +160,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
server = create_server( server = create_server(
certificate=server_cert, key=server_key, authenticate=__file__) certificate=server_cert, key=server_key, authenticate=__file__)
context = server.acceptor.ssl_context context = server.acceptor.ssl_context
self.assert_context(factory, context, cafile=__file__) self.assert_context(True, factory, context, cafile=__file__)
server.close() server.close()
@mock.patch('ssl.create_default_context') @mock.patch('ssl.create_default_context')
...@@ -165,7 +168,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -165,7 +168,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
server = create_server( server = create_server(
certificate=server_cert, key=server_key, authenticate=here) certificate=server_cert, key=server_key, authenticate=here)
context = server.acceptor.ssl_context context = server.acceptor.ssl_context
self.assert_context(factory, context, capath=here) self.assert_context(True, factory, context, capath=here)
server.close() server.close()
@mock.patch('ssl.create_default_context') @mock.patch('ssl.create_default_context')
...@@ -177,7 +180,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -177,7 +180,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
authenticate=here, authenticate=here,
) )
context = server.acceptor.ssl_context context = server.acceptor.ssl_context
self.assert_context( self.assert_context(True,
factory, context, (server_cert, server_key, pwfunc), capath=here) factory, context, (server_cert, server_key, pwfunc), capath=here)
server.close() server.close()
...@@ -197,7 +200,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -197,7 +200,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
context = ClientStorage.call_args[1]['ssl'] context = ClientStorage.call_args[1]['ssl']
self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'], self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'],
None) None)
self.assert_context( self.assert_context(False,
factory, context, (client_cert, client_key, None), factory, context, (client_cert, client_key, None),
check_hostname=True) check_hostname=True)
...@@ -213,7 +216,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -213,7 +216,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
context = ClientStorage.call_args[1]['ssl'] context = ClientStorage.call_args[1]['ssl']
self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'], self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'],
None) None)
self.assert_context( self.assert_context(False,
factory, context, (client_cert, client_key, None), factory, context, (client_cert, client_key, None),
capath=here, capath=here,
check_hostname=True, check_hostname=True,
...@@ -230,7 +233,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -230,7 +233,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
context = ClientStorage.call_args[1]['ssl'] context = ClientStorage.call_args[1]['ssl']
self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'], self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'],
None) None)
self.assert_context( self.assert_context(False,
factory, context, (client_cert, client_key, None), factory, context, (client_cert, client_key, None),
cafile=server_cert, cafile=server_cert,
check_hostname=True, check_hostname=True,
...@@ -249,7 +252,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -249,7 +252,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
context = ClientStorage.call_args[1]['ssl'] context = ClientStorage.call_args[1]['ssl']
self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'], self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'],
None) None)
self.assert_context( self.assert_context(False,
factory, context, (client_cert, client_key, pwfunc), factory, context, (client_cert, client_key, pwfunc),
cafile=server_cert, cafile=server_cert,
check_hostname=True, check_hostname=True,
...@@ -266,7 +269,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -266,7 +269,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
context = ClientStorage.call_args[1]['ssl'] context = ClientStorage.call_args[1]['ssl']
self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'], self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'],
'example.com') 'example.com')
self.assert_context( self.assert_context(False,
factory, context, (client_cert, client_key, None), factory, context, (client_cert, client_key, None),
cafile=server_cert, cafile=server_cert,
check_hostname=True, check_hostname=True,
...@@ -283,7 +286,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase): ...@@ -283,7 +286,7 @@ class SSLConfigTestMockiavellian(ZEOConfigTestBase):
context = ClientStorage.call_args[1]['ssl'] context = ClientStorage.call_args[1]['ssl']
self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'], self.assertEqual(ClientStorage.call_args[1]['ssl_server_hostname'],
None) None)
self.assert_context( self.assert_context(False,
factory, context, (client_cert, client_key, None), factory, context, (client_cert, client_key, None),
cafile=server_cert, cafile=server_cert,
check_hostname=False, check_hostname=False,
...@@ -362,7 +365,7 @@ def client_ssl(cafile=server_key, ...@@ -362,7 +365,7 @@ def client_ssl(cafile=server_key,
client_key=client_key, client_key=client_key,
): ):
context = ssl.create_default_context( context = ssl.create_default_context(
ssl.Purpose.CLIENT_AUTH, cafile=server_cert) ssl.Purpose.SERVER_AUTH, cafile=server_cert)
context.load_cert_chain(client_cert, client_key) context.load_cert_chain(client_cert, client_key)
context.verify_mode = ssl.CERT_REQUIRED context.verify_mode = ssl.CERT_REQUIRED
......
...@@ -15,7 +15,8 @@ def ssl_config(section, server): ...@@ -15,7 +15,8 @@ def ssl_config(section, server):
cafile=auth cafile=auth
context = ssl.create_default_context( context = ssl.create_default_context(
ssl.Purpose.CLIENT_AUTH, cafile=cafile, capath=capath) ssl.Purpose.CLIENT_AUTH if server else ssl.Purpose.SERVER_AUTH,
cafile=cafile, capath=capath)
if not auth: if not auth:
assert not server assert not server
......
...@@ -6,6 +6,7 @@ envlist = ...@@ -6,6 +6,7 @@ envlist =
py37 py37
py38 py38
py39 py39
py310
pypy pypy
pypy3 pypy3
simple simple
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment