From 7202c3af81c208521524389fcf374fd73211b51b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 27 May 2026 11:03:05 +0300 Subject: [PATCH 1/3] testing: fix `test_dont_write_bytecode` for Python 3.15 Python 3.15b1 no longer sets `module.__cached__`. But `module.__spec__.cached` is still set, is recommended over `module.__cached__` by Python documentation, and it works for all previous versions as well, so switch to that. Ref: https://docs.python.org/3.15/reference/datamodel.html#module.__file__ --- testing/test_assertrewrite.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 2668001af65..e11863547ba 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1082,9 +1082,10 @@ def test_dont_write_bytecode(self, pytester: Pytester, monkeypatch) -> None: """ import os def test_no_bytecode(): - assert "__pycache__" in __cached__ - assert not os.path.exists(__cached__) - assert not os.path.exists(os.path.dirname(__cached__))""" + assert "__pycache__" in __spec__.cached + assert not os.path.exists(__spec__.cached) + assert not os.path.exists(os.path.dirname(__spec__.cached)) + """ ) monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1") assert pytester.runpytest_subprocess().ret == 0 From 15427697a510c163313c04a19ab2a5ea8cc2dcf8 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 27 May 2026 11:18:02 +0300 Subject: [PATCH 2/3] testing: ignore "forkpty" deprecation errors coming from pexpect on Python 3.15 Nothing we can do about it, needs a new pexpect release, so ignore for now. --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 886c968e8ee..e588c6d19d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -415,6 +415,8 @@ filterwarnings = [ # https://github.com/pytest-dev/pytest/issues/2366 # https://github.com/pytest-dev/pytest/pull/13057 'default::pytest.PytestFDWarning', + # https://github.com/pexpect/pexpect/issues/827 + 'ignore:.*use of forkpty\(\) may lead to deadlocks in the child:DeprecationWarning:ptyprocess.*', ] pytester_example_dir = "testing/example_scripts" markers = [ From 3cd19882adacc6baeb5374f6c416962768a92ca0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 27 May 2026 11:10:31 +0300 Subject: [PATCH 3/3] Add official support for Python 3.15 Currently at beta 1. Fix #14524. --- .github/workflows/test.yml | 19 +++++++++++++++++++ changelog/14524.improvement.rst | 1 + pyproject.toml | 3 ++- tox.ini | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 changelog/14524.improvement.rst diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a42b59e5722..e70be0ab309 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,6 +65,7 @@ jobs: "windows-py312", "windows-py313", "windows-py314", + "windows-py315", "ubuntu-py310-unittest-asynctest", "ubuntu-py310-unittest-twisted24", @@ -77,12 +78,14 @@ jobs: "ubuntu-py312", "ubuntu-py313-pexpect", "ubuntu-py314", + "ubuntu-py315", "ubuntu-pypy3-xdist", "macos-py310", "macos-py312", "macos-py313", "macos-py314", + "macos-py315", "doctesting", "plugins", @@ -141,6 +144,11 @@ jobs: tox_env: "py314" use_coverage: true + - name: "windows-py315" + python: "3.15" + os: windows-latest + tox_env: "py315" + # Use separate jobs for different unittest flavors (twisted, asynctest) to ensure proper coverage. - name: "ubuntu-py310-unittest-asynctest" python: "3.10" @@ -208,6 +216,12 @@ jobs: tox_env: "py314" use_coverage: true + - name: "ubuntu-py315" + python: "3.15" + os: ubuntu-latest + tox_env: "py315" + use_coverage: true + - name: "ubuntu-pypy3-xdist" python: "pypy-3.10" os: ubuntu-latest @@ -236,6 +250,11 @@ jobs: os: macos-latest tox_env: "py314-xdist" + - name: "macos-py315" + python: "3.15" + os: macos-latest + tox_env: "py315-xdist" + - name: "plugins" python: "3.12" os: ubuntu-latest diff --git a/changelog/14524.improvement.rst b/changelog/14524.improvement.rst new file mode 100644 index 00000000000..e6b7c996077 --- /dev/null +++ b/changelog/14524.improvement.rst @@ -0,0 +1 @@ +Add official Python 3.15 support. diff --git a/pyproject.toml b/pyproject.toml index e588c6d19d2..cce08575ce1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Testing", "Topic :: Utilities", @@ -353,7 +354,7 @@ ignore = "W009" [tool.pyproject-fmt] indent = 4 -max_supported_python = "3.14" +max_supported_python = "3.15" [tool.pytest] minversion = "2.0" diff --git a/tox.ini b/tox.ini index 515313a9bf6..b37bdb6aa85 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ envlist = py312 py313 py314 + py315 pypy3 py310-{pexpect,xdist,twisted24,twisted25,asynctest,numpy,pluggymain,pylib} doctesting