From bab892e72cbada9203abc46f215380a2e3b11379 Mon Sep 17 00:00:00 2001 From: Roman Inflianskas Date: Fri, 28 Jun 2024 07:42:33 +0300 Subject: [PATCH] Add compatibility for Python 3.13 Closes https://github.com/aio-libs/aiosmtpd/issues/403. --- .github/workflows/ci-cd.yml | 2 +- aiosmtpd/docs/NEWS.rst | 8 ++++++++ aiosmtpd/tests/test_server.py | 15 +++++++++++---- setup.cfg | 1 + tox.ini | 3 ++- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 736b04e4..0cddd601 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -66,7 +66,7 @@ jobs: name: Test strategy: matrix: - pyver: ['3.8', '3.9', '3.10', '3.11', '3.12'] + pyver: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] os: [ubuntu, macos, windows] include: - pyver: pypy-3.8 diff --git a/aiosmtpd/docs/NEWS.rst b/aiosmtpd/docs/NEWS.rst index c509f656..1cad2c9a 100644 --- a/aiosmtpd/docs/NEWS.rst +++ b/aiosmtpd/docs/NEWS.rst @@ -4,6 +4,14 @@ .. towncrier release notes start +1.4.7 (aiosmtpd-next) +===================== + +Fixed/Improved +-------------- + +* Add compatibility for Python 3.13 (Closes #403) + 1.4.6 (2024-05-18) ================== diff --git a/aiosmtpd/tests/test_server.py b/aiosmtpd/tests/test_server.py index 443c0833..d2251d4a 100644 --- a/aiosmtpd/tests/test_server.py +++ b/aiosmtpd/tests/test_server.py @@ -448,10 +448,17 @@ def test_unixsocket(self, safe_socket_dir, autostop_loop, runner): # Stop the task cont.end() catchup_delay() - # Now the listener has gone away - # noinspection PyTypeChecker - with pytest.raises((socket.timeout, ConnectionError)): - assert_smtp_socket(cont) + if sys.version_info < (3, 13): + # Now the listener has gone away + # noinspection PyTypeChecker + with pytest.raises((socket.timeout, ConnectionError)): + assert_smtp_socket(cont) + else: + # Starting from Python 3.13, listening asyncio Unix socket is + # removed on close, see: + # https://github.com/python/cpython/issues/111246 + # https://github.com/python/cpython/pull/111483 + assert not Path(cont.unix_socket).exists() @pytest.mark.filterwarnings( "ignore::pytest.PytestUnraisableExceptionWarning" diff --git a/setup.cfg b/setup.cfg index 1e23cb17..b33900a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,6 +26,7 @@ classifiers = Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Communications :: Email :: Mail Transport Agents diff --git a/tox.ini b/tox.ini index e6e3ac99..76677b52 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.9.0 -envlist = qa, static, docs, py{38,39,310,311,312,py3}-{nocov,cov,diffcov} +envlist = qa, static, docs, py{38,39,310,311,312,313,py3}-{nocov,cov,diffcov} skip_missing_interpreters = True [testenv] @@ -41,6 +41,7 @@ setenv = py310: INTERP=py310 py311: INTERP=py311 py312: INTERP=py312 + py313: INTERP=py313 pypy3: INTERP=pypy3 pypy38: INTERP=pypy38 pypy39: INTERP=pypy39