Skip to content

Commit 6ab3416

Browse files
authored
Update python versions (drop 3.9, add 3.14) (#1256)
1 parent 1aaf9e0 commit 6ab3416

File tree

7 files changed

+34
-22
lines changed

7 files changed

+34
-22
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ jobs:
8686
python: '3.13'
8787
allow_failure: false
8888

89+
- name: py314-djmain-postgres-xdist-coverage
90+
python: '3.14'
91+
allow_failure: true
92+
93+
- name: py314-dj52-postgres-xdist-coverage
94+
python: '3.14'
95+
allow_failure: false
96+
8997
- name: py313-dj52-postgres-xdist-coverage
9098
python: '3.13'
9199
allow_failure: false
@@ -126,17 +134,13 @@ jobs:
126134
python: '3.10'
127135
allow_failure: false
128136

129-
- name: py39-dj42-mysql-xdist-coverage
130-
python: '3.9'
131-
allow_failure: false
132-
133137
- name: py313-djmain-sqlite-coverage
134138
python: '3.13'
135139
allow_failure: true
136140

137141
- name: py313-dj52-sqlite-coverage
138142
python: '3.13'
139-
allow_failure: true
143+
allow_failure: false
140144

141145
- name: py312-dj51-sqlite-xdist-coverage
142146
python: '3.12'
@@ -148,7 +152,7 @@ jobs:
148152

149153
# pypy3: not included with coverage reports (much slower then).
150154
- name: pypy3-dj42-postgres
151-
python: 'pypy3.9'
155+
python: 'pypy3.10'
152156
allow_failure: false
153157

154158
check: # This job does nothing and is only used for the branch protection

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pytest-django allows you to test your Django project/applications with the
3434

3535
* Django: 4.2, 5.1, 5.2 and latest main branch (compatible at the time
3636
of each release)
37-
* Python: CPython>=3.9 or PyPy 3
37+
* Python: CPython>=3.10 or PyPy 3
3838
* pytest: >=7.0
3939

4040
For compatibility with older versions, use previous pytest-django releases.

docs/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Changelog
44
v4.12.0 (Not released yet)
55
--------------------------
66

7+
Compatibility
8+
^^^^^^^^^^^^^
9+
10+
* Official Python 3.14 support.
11+
* Dropped support for Python 3.9, minimum version is now Python 3.10.
12+
713
Improvements
814
^^^^^^^^^^^^
915

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
99
name = "pytest-django"
1010
description = "A Django plugin for pytest."
1111
readme = "README.rst"
12-
requires-python = ">=3.9"
12+
requires-python = ">=3.10"
1313
dynamic = ["version"]
1414
authors = [
1515
{ name = "Andreas Pelme", email = "andreas@pelme.se" },
@@ -28,11 +28,11 @@ classifiers = [
2828
"License :: OSI Approved :: BSD License",
2929
"Operating System :: OS Independent",
3030
"Programming Language :: Python",
31-
"Programming Language :: Python :: 3.9",
3231
"Programming Language :: Python :: 3.10",
3332
"Programming Language :: Python :: 3.11",
3433
"Programming Language :: Python :: 3.12",
3534
"Programming Language :: Python :: 3.13",
35+
"Programming Language :: Python :: 3.14",
3636
"Programming Language :: Python :: Implementation :: CPython",
3737
"Programming Language :: Python :: Implementation :: PyPy",
3838
"Topic :: Software Development :: Testing",

pytest_django/asserts.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from __future__ import annotations
66

77
from functools import wraps
8-
from typing import TYPE_CHECKING, Any, Callable
8+
from typing import TYPE_CHECKING
99

1010
from django import VERSION
1111
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, TransactionTestCase
@@ -24,6 +24,15 @@ class MessagesTestCase(MessagesTestMixin, TestCase):
2424
else:
2525
test_case = TestCase("run")
2626

27+
if TYPE_CHECKING:
28+
from collections.abc import Callable, Collection, Iterator, Sequence
29+
from contextlib import AbstractContextManager
30+
from typing import Any, overload
31+
32+
from django import forms
33+
from django.db.models import Model, QuerySet, RawQuerySet
34+
from django.http.response import HttpResponseBase
35+
2736

2837
def _wrapper(name: str) -> Callable[..., Any]:
2938
func = getattr(test_case, name)
@@ -55,13 +64,6 @@ def assertion_func(*args: Any, **kwargs: Any) -> Any:
5564

5665

5766
if TYPE_CHECKING:
58-
from collections.abc import Collection, Iterator, Sequence
59-
from contextlib import AbstractContextManager
60-
from typing import overload
61-
62-
from django import forms
63-
from django.db.models import Model, QuerySet, RawQuerySet
64-
from django.http.response import HttpResponseBase
6567

6668
def assertRedirects(
6769
response: HttpResponseBase,

pytest_django/fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import os
6-
from collections.abc import Generator, Iterable, Sequence
6+
from collections.abc import Callable, Generator, Iterable, Sequence
77
from contextlib import AbstractContextManager, contextmanager
88
from functools import partial
99
from typing import TYPE_CHECKING, Protocol
@@ -16,16 +16,16 @@
1616

1717

1818
if TYPE_CHECKING:
19-
from typing import Any, Callable, Literal, Optional, Union
19+
from typing import Any, Literal
2020

2121
import django
2222
import django.test
2323

2424
from . import DjangoDbBlocker
2525
from .django_compat import _User, _UserModel
2626

27-
_DjangoDbDatabases = Optional[Union[Literal["__all__"], Iterable[str]]]
28-
_DjangoDbAvailableApps = Optional[list[str]]
27+
_DjangoDbDatabases = Literal["__all__"] | Iterable[str] | None
28+
_DjangoDbAvailableApps = list[str] | None
2929
# transaction, reset_sequences, databases, serialized_rollback, available_apps
3030
_DjangoDb = tuple[bool, bool, _DjangoDbDatabases, bool, _DjangoDbAvailableApps]
3131

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tox]
22
envlist =
3+
py314-dj{main,52,51}-postgres
34
py313-dj{main,52,51}-postgres
45
py312-dj{main,52,51,42}-postgres
56
py311-dj{main,52,51,42}-postgres
67
py310-dj{main,52,51,42}-postgres
7-
py39-dj42-postgres
88
linting
99

1010
[testenv]

0 commit comments

Comments
 (0)