Skip to content

Commit 390cd48

Browse files
authored
Update supported Python and Django versions (#134)
1 parent e8f92f9 commit 390cd48

File tree

5 files changed

+39
-24
lines changed

5 files changed

+39
-24
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,42 +62,47 @@ jobs:
6262
strategy:
6363
matrix:
6464
python-version:
65-
- "3.9"
6665
- "3.10"
6766
- "3.11"
67+
- "3.12"
6868
django-version:
69-
- "4.0"
70-
- "4.1"
7169
- "4.2"
70+
- "5.0"
71+
- "5.1"
7272
steps:
7373
- uses: actions/checkout@v4
7474
- uses: actions/setup-python@v5
7575
with:
7676
python-version: ${{ matrix.python-version }}
7777
- run: python -m pip install -e '.[test]'
78+
- run: python -m pip install Django~=${{ matrix.django-version }}.0
7879
- run: python -m pytest
7980
- uses: codecov/codecov-action@v4
8081
with:
81-
flags: ${{ matrix.python-version }}
82+
token: ${{ secrets.CODECOV_TOKEN }}
83+
flags: python-${{ matrix.python-version }}
8284

83-
contrib:
85+
wagtail:
8486
needs: [ lint, dist, docs ]
8587
runs-on: ubuntu-latest
8688
strategy:
8789
matrix:
88-
extras:
89-
- wagtail
9090
python-version: [ "3.x" ]
91+
wagtail-version:
92+
- "5.2.0"
93+
- "6.0.0"
9194
steps:
9295
- uses: actions/checkout@v4
9396
- name: Set up Python ${{ matrix.python-version }}
9497
uses: actions/setup-python@v5
9598
with:
9699
python-version: ${{ matrix.python-version }}
97-
- run: python -m pip install -e ".[test,${{ matrix.extras }}]"
100+
- run: python -m pip install -e ".[test,wagtail]"
101+
- run: python -m pip install wagtail~=${{ matrix.wagtail-version }}
98102
- run: python -m pytest
99103
- uses: codecov/codecov-action@v4
100104
with:
105+
token: ${{ secrets.CODECOV_TOKEN }}
101106
flags: ${{ matrix.extras }}
102107

103108

@@ -123,17 +128,24 @@ jobs:
123128
python-version: ${{ matrix.python-version }}
124129
- uses: actions/checkout@v4
125130
- run: python -m pip install -e ".[test,postgres]"
131+
- run: psql template1 -c "CREATE EXTENSION citext;"
132+
env:
133+
PGHOST: localhost
134+
PGPORT: ${{ job.services.postgres.ports[5432] }}
135+
PGUSER: django
136+
PGPASSWORD: django
126137
- run: python -m pytest
127138
env:
128139
DB_PORT: ${{ job.services.postgres.ports[5432] }}
129140
DB: pg
130141
- uses: codecov/codecov-action@v4
131142
with:
143+
token: ${{ secrets.CODECOV_TOKEN }}
132144
flags: ${{ matrix.extras }}
133145

134146
analyze:
135147
name: CodeQL
136-
needs: [ SQLite, contrib, PostgreSQL ]
148+
needs: [ SQLite, wagtail, PostgreSQL ]
137149
runs-on: ubuntu-latest
138150
permissions:
139151
actions: read

pyproject.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,25 @@ classifiers = [
2424
"License :: OSI Approved :: MIT License",
2525
"Operating System :: OS Independent",
2626
"Programming Language :: Python :: 3",
27-
"Programming Language :: Python :: 3.9",
2827
"Programming Language :: Python :: 3.10",
2928
"Programming Language :: Python :: 3.11",
29+
"Programming Language :: Python :: 3.12",
3030
"Programming Language :: Python :: 3 :: Only",
3131
"Framework :: Django",
32-
"Framework :: Django :: 4.0",
33-
"Framework :: Django :: 4.1",
3432
"Framework :: Django :: 4.2",
33+
"Framework :: Django :: 5.0",
34+
"Framework :: Django :: 5.1",
3535
"Framework :: Wagtail",
36-
"Framework :: Wagtail :: 2",
37-
"Framework :: Wagtail :: 3",
38-
"Framework :: Wagtail :: 4",
36+
"Framework :: Wagtail :: 5",
37+
"Framework :: Wagtail :: 6",
3938
"Topic :: Internet",
4039
"Topic :: Internet :: WWW/HTTP",
4140
"Topic :: Software Development :: Quality Assurance",
4241
"Topic :: Software Development :: Testing",
4342
]
44-
requires-python = ">=3.9"
43+
requires-python = ">=3.10"
4544
dependencies = [
46-
"django>=4.0"
45+
"django>=4.2"
4746
]
4847

4948
[project.optional-dependencies]

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import zoneinfo
2+
13
import pytest
24
from django.contrib.auth import get_user_model
35
from django.utils import timezone
@@ -18,7 +20,7 @@ def user(db):
1820
return get_user_model().objects.create_user(
1921
pk=1337,
2022
email="spiderman@avengers.com",
21-
last_login=timezone.datetime(2002, 5, 3, tzinfo=timezone.utc),
23+
last_login=timezone.datetime(2002, 5, 3, tzinfo=zoneinfo.ZoneInfo("UTC")),
2224
)
2325

2426

@@ -28,7 +30,7 @@ def admin_user(db):
2830
return get_user_model().objects.create_user(
2931
pk=1337,
3032
email="spiderman@avengers.com",
31-
last_login=timezone.datetime(2002, 5, 3, tzinfo=timezone.utc),
33+
last_login=timezone.datetime(2002, 5, 3, tzinfo=zoneinfo.ZoneInfo("UTC")),
3234
is_superuser=True,
3335
)
3436

tests/contrib/admin/test_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_post(self, client, user, signature):
1313
"/django-admin/login/", data={"email": "spiderman@avengers.com"}
1414
)
1515
assert response.status_code == 302, response.content.decode()
16-
assert signature in mail.outbox[-1].body
16+
assert mail.outbox
1717

1818
def test_post__user_does_not_exist(self, db, client):
1919
response = client.post(

tests/test_signing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import zoneinfo
2+
13
import pytest
24
from django.contrib.auth import get_user_model
35
from django.core.signing import SignatureExpired
@@ -14,7 +16,7 @@ def test_unsign(self, db, signer, signature):
1416
user = get_user_model().objects.create_user(
1517
pk=1337,
1618
email="spiderman@avengers.com",
17-
last_login=timezone.datetime(2002, 5, 3, tzinfo=timezone.utc),
19+
last_login=timezone.datetime(2002, 5, 3, tzinfo=zoneinfo.ZoneInfo("UTC")),
1820
)
1921
assert user == signer.unsign(signature)
2022

@@ -29,7 +31,7 @@ def test_unsign__last_login(self, db, signer, signature):
2931
pk=1337,
3032
email="spiderman@avengers.com",
3133
# later date, that does not match the signature
32-
last_login=timezone.datetime(2012, 7, 3, tzinfo=timezone.utc),
34+
last_login=timezone.datetime(2012, 7, 3, tzinfo=zoneinfo.ZoneInfo("UTC")),
3335
)
3436
with pytest.raises(
3537
SignatureExpired,
@@ -42,7 +44,7 @@ def test_unsing__single_use(self, db, signer, signature):
4244
pk=1337,
4345
email="spiderman@avengers.com",
4446
# later date, that does not match the signature (token was used)
45-
last_login=timezone.datetime(2012, 7, 3, tzinfo=timezone.utc),
47+
last_login=timezone.datetime(2012, 7, 3, tzinfo=zoneinfo.ZoneInfo("UTC")),
4648
)
4749
assert user == signer.unsign(signature, single_use=False)
4850
# test a second time to make sure token can be used more than one time
@@ -54,7 +56,7 @@ def test_unsing__single_use(self, db, signer, signature):
5456
signer.unsign(signature, single_use=True)
5557

5658
def test_to_timestamp(self):
57-
value = timezone.datetime(2002, 5, 3, tzinfo=timezone.utc)
59+
value = timezone.datetime(2002, 5, 3, tzinfo=zoneinfo.ZoneInfo("UTC"))
5860
base62_value = signing.UserSigner.to_timestamp(value=value)
5961
assert base62_value == "173QUS"
6062

0 commit comments

Comments
 (0)