Skip to content

Commit

Permalink
chore: add support for Django 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed Sep 19, 2022
1 parent b10edca commit 065c9b7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -37,6 +37,13 @@ jobs:
python-version: "3.9"
- tox-env: "py310-dj40"
python-version: "3.10"
# Django 4.1
- tox-env: "py38-dj41"
python-version: "3.8"
- tox-env: "py39-dj41"
python-version: "3.9"
- tox-env: "py310-dj41"
python-version: "3.10"

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -26,6 +26,7 @@ classifiers =
Framework :: Django :: 2.2
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Framework :: Django :: 4.1
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Internet :: WWW/HTTP :: WSGI
Expand Down
22 changes: 15 additions & 7 deletions tests/test_shop.py
Expand Up @@ -4,6 +4,7 @@
from operator import mul
from unittest import skipUnless

import django
from django.test import TestCase
from django.test.client import RequestFactory
from django.urls import reverse
Expand Down Expand Up @@ -311,12 +312,19 @@ def test_discount_codes(self):
self._empty_cart(cart)
self._add_to_cart(invalid_variation, 1)
r = self.client.post(reverse("shop_cart"), post_data)
self.assertFormError(
r,
"discount_form",
"discount_code",
_("The discount code entered is invalid."),
)
if django.VERSION >= (4, 1):
self.assertFormError(
r.context["discount_form"],
"discount_code",
_("The discount code entered is invalid."),
)
else:
self.assertFormError(
r,
"discount_form",
"discount_code",
_("The discount code entered is invalid."),
)

def test_order(self):
"""
Expand Down Expand Up @@ -408,7 +416,7 @@ def test_sale_save(self):
"""
Regression test for GitHub issue #24. Incorrect exception handle meant
that in some cases (usually percentage discount) sale_prices were not
being applied to all products and their variations.
being applied to all products and their varitations.
Note: This issues was only relevant using MySQL and with exceptions
turned on (which is the default when DEBUG=True).
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
py{37,38,39,310}-dj{22,32,40}
py{37,38,39,310}-dj{22,32,40,41}
package
lint

Expand All @@ -12,6 +12,7 @@ deps =
dj22: Django>=2.2, <3
dj32: Django>=3.2, <3.3
dj40: Django>=4.0, <4.1
dj41: Django>=4.1, <4.2
commands =
pytest --basetemp="{envtmpdir}" --junitxml="junit/TEST-{envname}.xml" {posargs}

Expand Down

0 comments on commit 065c9b7

Please sign in to comment.