Skip to content

Commit

Permalink
Update the CI matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Nov 12, 2024
1 parent 05d1594 commit f51dcef
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
rev: 1.22.1
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
args: [--target-version, "4.2"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.0"
hooks:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Change log
Next version
~~~~~~~~~~~~

- Raised minimum versions to Python 3.10, Django 4.2.


0.3 (2023-11-01)
~~~~~~~~~~~~~~~~

Expand Down
59 changes: 29 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = { text = "BSD-3-Clause" }
authors = [
{ name = "Matthias Kestenholz", email = "[email protected]" },
]
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
Expand All @@ -21,7 +21,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -34,7 +33,7 @@ dynamic = [
"version",
]
dependencies = [
"django>=3.2",
"django>=4.2",
"feincms3>=5.0a2",
]
optional-dependencies.tests = [
Expand All @@ -47,58 +46,58 @@ urls.Homepage = "https://github.com/matthiask/feincms3-language-sites/"
path = "feincms3_language_sites/__init__.py"

[tool.ruff]
target-version = "py39"
target-version = "py310"

fix = true
show-fixes = true
extend-select = [
# pyflakes, pycodestyle
"F",
"E",
"W",
# mmcabe
"C90",
# isort
"I",
# pep8-naming
"N",
# pyupgrade
"UP",
# flake8-2020
"YTT",
# flake8-boolean-trap
"FBT",
lint.extend-select = [
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# mmcabe
"C90",
# flake8-django
"DJ",
# flake8-pie
"PIE",
# flake8-simplify
"SIM",
"E",
# pyflakes, pycodestyle
"F",
# flake8-boolean-trap
"FBT",
# isort
"I",
# flake8-gettext
"INT",
# pep8-naming
"N",
# pygrep-hooks
"PGH",
# flake8-pie
"PIE",
# pylint
"PL",
# unused noqa
"RUF100",
# flake8-simplify
"SIM",
# pyupgrade
"UP",
"W",
# flake8-2020
"YTT",
]
extend-ignore = [
lint.extend-ignore = [
# Allow zip() without strict=
"B905",
# No line length errors
"E501",
]
isort.combine-as-imports = true
isort.lines-after-imports = 2
mccabe.max-complexity = 15
per-file-ignores."*/migrat*/*" = [
lint.per-file-ignores."*/migrat*/*" = [
# Allow using PascalCase model names in migrations
"N806",
# Ignore the fact that migration files are invalid module names
"N999",
]
lint.isort.combine-as-imports = true
lint.isort.lines-after-imports = 2
lint.mccabe.max-complexity = 15
20 changes: 14 additions & 6 deletions tests/testapp/test_feincms3.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def test_redirect(self):
is_active=True,
)

response = self.client.get("/de/", HTTP_HOST="de.example.com")
response = self.client.get("/de/", headers={"host": "de.example.com"})
self.assertContains(response, "<h1>de</h1>")

response = self.client.get("/de/", HTTP_HOST="fr.example.com")
response = self.client.get("/de/", headers={"host": "fr.example.com"})
self.assertEqual(response.status_code, 404)

response = self.client.get("/de/")
Expand All @@ -98,11 +98,15 @@ def test_redirect(self):
self.assertEqual(response.status_code, 301)
self.assertEqual(response["Location"], "https://de.example.com/de/")

response = self.client.get("/de/", HTTP_HOST="de.example.com", secure=False)
response = self.client.get(
"/de/", headers={"host": "de.example.com"}, secure=False
)
self.assertEqual(response.status_code, 301)
self.assertEqual(response["Location"], "https://de.example.com/de/")

response = self.client.get("/de/", HTTP_HOST="de.example.com", secure=True)
response = self.client.get(
"/de/", headers={"host": "de.example.com"}, secure=True
)
self.assertEqual(response.status_code, 200)

with override_settings(SECURE_SSL_REDIRECT=False):
Expand All @@ -114,10 +118,14 @@ def test_redirect(self):
self.assertEqual(response.status_code, 301)
self.assertEqual(response["Location"], "https://de.example.com/de/")

response = self.client.get("/de/", HTTP_HOST="de.example.com", secure=False)
response = self.client.get(
"/de/", headers={"host": "de.example.com"}, secure=False
)
self.assertEqual(response.status_code, 200)

response = self.client.get("/de/", HTTP_HOST="de.example.com", secure=True)
response = self.client.get(
"/de/", headers={"host": "de.example.com"}, secure=True
)
self.assertEqual(response.status_code, 200)

# self.assertContains(response, "<h1>de</h1>")
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tox]
envlist =
py{38,39}-dj{32,41,42}
py{310,311}-dj{32,41,42,main}
py{310}-dj{42}
py{310,311,312}-dj{42,50,51,main}
py{313}-dj{51,main}

[testenv]
usedevelop = true
Expand All @@ -10,7 +11,7 @@ commands =
python -Wd {envbindir}/coverage run tests/manage.py test -v2 --keepdb {posargs:testapp}
coverage report -m
deps =
dj32: Django>=3.2,<4.0
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
dj51: Django>=5.1,<5.2
djmain: https://github.com/django/django/archive/main.tar.gz

0 comments on commit f51dcef

Please sign in to comment.