Skip to content

Commit

Permalink
Add Python 3.12 to the test matrix. (#1816)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
tim-schilling and matthiask committed Oct 14, 2023
1 parent 58293b4 commit 036e8db
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

services:
mariadb:
Expand All @@ -36,6 +36,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Get pip cache dir
id: pip-cache
Expand Down Expand Up @@ -77,14 +78,16 @@ jobs:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
database: [postgresql, postgis]
# Add psycopg3 to our matrix for 3.10 and 3.11
# Add psycopg3 to our matrix for modern python versions
include:
- python-version: '3.10'
database: psycopg3
- python-version: '3.11'
database: psycopg3
- python-version: '3.12'
database: psycopg3

services:
postgres:
Expand All @@ -108,6 +111,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Get pip cache dir
id: pip-cache
Expand Down Expand Up @@ -152,7 +156,7 @@ jobs:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand All @@ -161,6 +165,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Get pip cache dir
id: pip-cache
Expand Down
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change log
Pending
-------

* Added Python 3.12 to test matrix.
* Removed outdated third-party panels from the list.
* Avoided the unnecessary work of recursively quoting SQL parameters.
* Postponed context process in templates panel to include lazy evaluated
Expand Down
7 changes: 7 additions & 0 deletions tests/panels/test_profiling.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import sys
import unittest

from django.contrib.auth.models import User
from django.db import IntegrityError, transaction
from django.http import HttpResponse
Expand Down Expand Up @@ -50,6 +53,10 @@ def test_cum_time_threshold(self):
self.assertNotIn("render", content)
self.assertValidHTML(content)

@unittest.skipUnless(
sys.version_info < (3, 12, 0),
"Python 3.12 no longer contains a frame for list comprehensions.",
)
def test_listcomp_escaped(self):
self._get_response = lambda request: listcomp_view(request)
response = self.panel.process_request(self.request)
Expand Down
15 changes: 10 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ envlist =
py{38,39,310}-dj32-{sqlite,postgresql,postgis,mysql}
py310-dj40-sqlite
py{310,311}-dj41-{sqlite,postgresql,postgis,mysql}
py{310,311}-dj{42,50,main}-{sqlite,postgresql,psycopg3,postgis,mysql}
py{310,311,312}-dj{42,50,main}-{sqlite,postgresql,psycopg3,postgis,mysql}

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

[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-{postgresql,psycopg3}]

[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-{postgresql,psycopg3}]
setenv =
{[testenv]setenv}
DB_BACKEND = postgresql
DB_PORT = {env:DB_PORT:5432}

[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-postgis]

[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-postgis]
setenv =
{[testenv]setenv}
DB_BACKEND = postgis
DB_PORT = {env:DB_PORT:5432}

[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-mysql]

[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-mysql]
setenv =
{[testenv]setenv}
DB_BACKEND = mysql
DB_PORT = {env:DB_PORT:3306}

[testenv:py{38,39,310,311}-dj{32,40,41,42,50,main}-sqlite]

[testenv:py{38,39,310,311,312}-dj{32,40,41,42,50,main}-sqlite]
setenv =
{[testenv]setenv}
DB_BACKEND = sqlite3
Expand Down Expand Up @@ -96,6 +100,7 @@ python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DB_BACKEND =
Expand Down

0 comments on commit 036e8db

Please sign in to comment.