Skip to content

Commit 7c99f33

Browse files
authored
Remove Python 3.8 & Django 5.0 (#1202)
1 parent 0494481 commit 7c99f33

File tree

13 files changed

+35
-52
lines changed

13 files changed

+35
-52
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ jobs:
7171
python: '3.13'
7272
allow_failure: false
7373

74+
# Explicitly test min pytest.
75+
- name: py313-dj52-sqlite-pytestmin-coverage
76+
python: '3.13'
77+
allow_failure: false
78+
7479
- name: py313-dj52-postgres-xdist-coverage
7580
python: '3.13'
7681
allow_failure: false
@@ -131,15 +136,6 @@ jobs:
131136
python: '3.11'
132137
allow_failure: false
133138

134-
- name: py38-dj42-sqlite-xdist-coverage
135-
python: '3.8'
136-
allow_failure: false
137-
138-
# Explicitly test min pytest.
139-
- name: py38-dj42-sqlite-pytestmin-coverage
140-
python: '3.8'
141-
allow_failure: false
142-
143139
# pypy3: not included with coverage reports (much slower then).
144140
- name: pypy3-dj42-postgres
145141
python: 'pypy3.9'

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ pytest-django allows you to test your Django project/applications with the
3232
<https://pytest-django.readthedocs.io/en/latest/contributing.html>`_
3333
* Version compatibility:
3434

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

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

docs/contributing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ writing), running them all will take a long time. All valid configurations can
140140
be found in `tox.ini`. To test against a few of them, invoke tox with the `-e`
141141
flag::
142142

143-
$ tox -e py38-dj32-postgres,py310-dj41-mysql
143+
$ tox -e py39-dj42-postgres,py310-dj52-mysql
144144

145-
This will run the tests on Python 3.8/Django 3.2/PostgeSQL and Python
146-
3.10/Django 4.1/MySQL.
145+
This will run the tests on Python 3.9/Django 4.2/PostgeSQL and Python
146+
3.10/Django 5.2/MySQL.
147147

148148

149149
Measuring test coverage

pyproject.toml

Lines changed: 1 addition & 3 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.8"
12+
requires-python = ">=3.9"
1313
dynamic = ["version"]
1414
authors = [
1515
{ name = "Andreas Pelme", email = "[email protected]" },
@@ -22,14 +22,12 @@ classifiers = [
2222
"Development Status :: 5 - Production/Stable",
2323
"Framework :: Django",
2424
"Framework :: Django :: 4.2",
25-
"Framework :: Django :: 5.0",
2625
"Framework :: Django :: 5.1",
2726
"Framework :: Django :: 5.2",
2827
"Intended Audience :: Developers",
2928
"License :: OSI Approved :: BSD License",
3029
"Operating System :: OS Independent",
3130
"Programming Language :: Python",
32-
"Programming Language :: Python :: 3.8",
3331
"Programming Language :: Python :: 3.9",
3432
"Programming Language :: Python :: 3.10",
3533
"Programming Language :: Python :: 3.11",

pytest_django/asserts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
from __future__ import annotations
66

7+
from collections.abc import Sequence
78
from functools import wraps
8-
from typing import TYPE_CHECKING, Any, Callable, Sequence
9+
from typing import TYPE_CHECKING, Any, Callable
910

1011
from django import VERSION
1112
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, TransactionTestCase

pytest_django/fixtures.py

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

55
import os
6-
from contextlib import contextmanager
6+
from collections.abc import Generator, Iterable, Sequence
7+
from contextlib import AbstractContextManager, contextmanager
78
from functools import partial
8-
from typing import (
9-
TYPE_CHECKING,
10-
AbstractSet,
11-
Any,
12-
Callable,
13-
ContextManager,
14-
Generator,
15-
Iterable,
16-
List,
17-
Literal,
18-
Optional,
19-
Protocol,
20-
Sequence,
21-
Tuple,
22-
Union,
23-
)
9+
from typing import TYPE_CHECKING, Any, Callable, Literal, Optional, Protocol, Union
2410

2511
import pytest
2612

@@ -37,9 +23,9 @@
3723

3824

3925
_DjangoDbDatabases = Optional[Union[Literal["__all__"], Iterable[str]]]
40-
_DjangoDbAvailableApps = Optional[List[str]]
26+
_DjangoDbAvailableApps = Optional[list[str]]
4127
# transaction, reset_sequences, databases, serialized_rollback, available_apps
42-
_DjangoDb = Tuple[bool, bool, _DjangoDbDatabases, bool, _DjangoDbAvailableApps]
28+
_DjangoDb = tuple[bool, bool, _DjangoDbDatabases, bool, _DjangoDbAvailableApps]
4329

4430

4531
__all__ = [
@@ -157,7 +143,7 @@ def _get_databases_for_test(test: pytest.Item) -> tuple[Iterable[str], bool]:
157143

158144
def _get_databases_for_setup(
159145
items: Sequence[pytest.Item],
160-
) -> tuple[AbstractSet[str], AbstractSet[str]]:
146+
) -> tuple[set[str], set[str]]:
161147
"""Get the database aliases that need to be setup, and the subset that needs
162148
to be serialized."""
163149
# Code derived from django.test.utils.DiscoverRunner.get_databases().
@@ -736,7 +722,7 @@ def __call__(
736722
*,
737723
using: str = ...,
738724
execute: bool = ...,
739-
) -> ContextManager[list[Callable[[], Any]]]:
725+
) -> AbstractContextManager[list[Callable[[], Any]]]:
740726
pass # pragma: no cover
741727

742728

pytest_django/plugin.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
import pathlib
1313
import sys
1414
import types
15+
from collections.abc import Generator
16+
from contextlib import AbstractContextManager
1517
from functools import reduce
16-
from typing import TYPE_CHECKING, ContextManager, Generator, List, NoReturn
18+
from typing import TYPE_CHECKING, NoReturn
1719

1820
import pytest
1921

@@ -259,7 +261,7 @@ def _get_boolean_value(
259261
) from None
260262

261263

262-
report_header_key = pytest.StashKey[List[str]]()
264+
report_header_key = pytest.StashKey[list[str]]()
263265

264266

265267
@pytest.hookimpl()
@@ -837,13 +839,13 @@ def _blocking_wrapper(*args, **kwargs) -> NoReturn:
837839
'"db" or "transactional_db" fixtures to enable it.'
838840
)
839841

840-
def unblock(self) -> ContextManager[None]:
842+
def unblock(self) -> AbstractContextManager[None]:
841843
"""Enable access to the Django database."""
842844
self._save_active_wrapper()
843845
self._dj_db_wrapper.ensure_connection = self._real_ensure_connection
844846
return _DatabaseBlockerContextManager(self)
845847

846-
def block(self) -> ContextManager[None]:
848+
def block(self) -> AbstractContextManager[None]:
847849
"""Disable access to the Django database."""
848850
self._save_active_wrapper()
849851
self._dj_db_wrapper.ensure_connection = self._blocking_wrapper

pytest_django/runner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from argparse import ArgumentParser
2-
from typing import Any, Iterable
2+
from collections.abc import Iterable
3+
from typing import Any
34

45

56
class TestRunner:

pytest_django_test/db_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import sqlite3
55
import subprocess
6-
from typing import Mapping
6+
from collections.abc import Mapping
77

88
import pytest
99
from django.conf import settings

tests/test_database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Generator
3+
from collections.abc import Generator
44

55
import pytest
66
from django.db import connection, transaction

0 commit comments

Comments
 (0)