Skip to content

Commit 036e8db

Browse files
Add Python 3.12 to the test matrix. (#1816)
* Add Python 3.12 to the test matrix. * Allow pre-releases for setup actions with GitHub actions. * Skip unnecessary test for python 3.12 * Update docs/changes.rst Co-authored-by: Matthias Kestenholz <mk@feinheit.ch> --------- Co-authored-by: Matthias Kestenholz <mk@feinheit.ch>
1 parent 58293b4 commit 036e8db

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

.github/workflows/test.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
max-parallel: 5
1616
matrix:
17-
python-version: ['3.8', '3.9', '3.10', '3.11']
17+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
1818

1919
services:
2020
mariadb:
@@ -36,6 +36,7 @@ jobs:
3636
uses: actions/setup-python@v4
3737
with:
3838
python-version: ${{ matrix.python-version }}
39+
allow-prereleases: true
3940

4041
- name: Get pip cache dir
4142
id: pip-cache
@@ -77,14 +78,16 @@ jobs:
7778
fail-fast: false
7879
max-parallel: 5
7980
matrix:
80-
python-version: ['3.8', '3.9', '3.10', '3.11']
81+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
8182
database: [postgresql, postgis]
82-
# Add psycopg3 to our matrix for 3.10 and 3.11
83+
# Add psycopg3 to our matrix for modern python versions
8384
include:
8485
- python-version: '3.10'
8586
database: psycopg3
8687
- python-version: '3.11'
8788
database: psycopg3
89+
- python-version: '3.12'
90+
database: psycopg3
8891

8992
services:
9093
postgres:
@@ -108,6 +111,7 @@ jobs:
108111
uses: actions/setup-python@v4
109112
with:
110113
python-version: ${{ matrix.python-version }}
114+
allow-prereleases: true
111115

112116
- name: Get pip cache dir
113117
id: pip-cache
@@ -152,7 +156,7 @@ jobs:
152156
fail-fast: false
153157
max-parallel: 5
154158
matrix:
155-
python-version: ['3.8', '3.9', '3.10', '3.11']
159+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
156160

157161
steps:
158162
- uses: actions/checkout@v3
@@ -161,6 +165,7 @@ jobs:
161165
uses: actions/setup-python@v4
162166
with:
163167
python-version: ${{ matrix.python-version }}
168+
allow-prereleases: true
164169

165170
- name: Get pip cache dir
166171
id: pip-cache

docs/changes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Change log
44
Pending
55
-------
66

7+
* Added Python 3.12 to test matrix.
78
* Removed outdated third-party panels from the list.
89
* Avoided the unnecessary work of recursively quoting SQL parameters.
910
* Postponed context process in templates panel to include lazy evaluated

tests/panels/test_profiling.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import sys
2+
import unittest
3+
14
from django.contrib.auth.models import User
25
from django.db import IntegrityError, transaction
36
from django.http import HttpResponse
@@ -50,6 +53,10 @@ def test_cum_time_threshold(self):
5053
self.assertNotIn("render", content)
5154
self.assertValidHTML(content)
5255

56+
@unittest.skipUnless(
57+
sys.version_info < (3, 12, 0),
58+
"Python 3.12 no longer contains a frame for list comprehensions.",
59+
)
5360
def test_listcomp_escaped(self):
5461
self._get_response = lambda request: listcomp_view(request)
5562
response = self.panel.process_request(self.request)

tox.ini

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ envlist =
66
py{38,39,310}-dj32-{sqlite,postgresql,postgis,mysql}
77
py310-dj40-sqlite
88
py{310,311}-dj41-{sqlite,postgresql,postgis,mysql}
9-
py{310,311}-dj{42,50,main}-{sqlite,postgresql,psycopg3,postgis,mysql}
9+
py{310,311,312}-dj{42,50,main}-{sqlite,postgresql,psycopg3,postgis,mysql}
1010

1111
[testenv]
1212
deps =
@@ -50,25 +50,29 @@ allowlist_externals = make
5050
pip_pre = True
5151
commands = python -b -W always -m coverage run -m django test -v2 {posargs:tests}
5252

53-
[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-{postgresql,psycopg3}]
53+
54+
[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-{postgresql,psycopg3}]
5455
setenv =
5556
{[testenv]setenv}
5657
DB_BACKEND = postgresql
5758
DB_PORT = {env:DB_PORT:5432}
5859

59-
[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-postgis]
60+
61+
[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-postgis]
6062
setenv =
6163
{[testenv]setenv}
6264
DB_BACKEND = postgis
6365
DB_PORT = {env:DB_PORT:5432}
6466

65-
[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-mysql]
67+
68+
[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-mysql]
6669
setenv =
6770
{[testenv]setenv}
6871
DB_BACKEND = mysql
6972
DB_PORT = {env:DB_PORT:3306}
7073

71-
[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-sqlite]
74+
75+
[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-sqlite]
7276
setenv =
7377
{[testenv]setenv}
7478
DB_BACKEND = sqlite3
@@ -96,6 +100,7 @@ python =
96100
3.9: py39
97101
3.10: py310
98102
3.11: py311
103+
3.12: py312
99104

100105
[gh-actions:env]
101106
DB_BACKEND =

0 commit comments

Comments
 (0)