Skip to content

Commit 53cd6db

Browse files
authored
Add dedicated CI jobs for DjangoMessage tests with Django 4.2/5.2/6.0 (#203)
* Add dedicated CI jobs for DjangoMessage tests with Django 4.2/5.2/6.0 Closes #201 * Add coverage reporting to django tox envs * Fix coverage omit for testsuite by passing --cov-config=setup.cfg
1 parent 579c280 commit 53cd6db

5 files changed

Lines changed: 56 additions & 2 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,32 @@ jobs:
3434
python -m pip install -U pip
3535
- run: pip install tox
3636
- name: run tests
37-
run: tox -e ${{ matrix.tox }} -- -m "not e2e"
37+
run: tox -e ${{ matrix.tox }} -- -m "not e2e and not django"
38+
39+
django:
40+
name: "django / ${{ matrix.django }}"
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- {django: '4.2', tox: django42}
47+
- {django: '5.2', tox: django52}
48+
- {django: '6.0', tox: django60}
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.12'
54+
cache: pip
55+
- name: update pip
56+
run: |
57+
pip install -U wheel
58+
pip install -U setuptools
59+
python -m pip install -U pip
60+
- run: pip install tox
61+
- name: run django tests
62+
run: tox -e ${{ matrix.tox }}
3863

3964
typecheck:
4065
name: "typecheck"

emails/testsuite/django_/test_django_integrations.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import warnings
2+
import pytest
23
import emails
34
import emails.message
5+
6+
django = pytest.importorskip("django")
47
from emails.django import DjangoMessage
58

9+
pytestmark = pytest.mark.django
10+
611

712
def test_django_message_proxy(django_email_backend):
813

requirements/tests-django.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--requirement=base.txt
2+
--requirement=tests-base.txt

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ignore_errors = true
3737
norecursedirs = .* {arch} *.egg *.egg-info dist build requirements
3838
markers =
3939
e2e: tests that require a running SMTP server
40+
django: tests that require Django
4041

4142
[coverage:run]
4243
omit = emails/testsuite/*

tox.ini

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ envlist = py310, py311, py312, py313, py314, pypy, style
33

44
[testenv]
55
passenv = TEST_*,SMTP_TEST_*
6-
commands = py.test --cov-report term --cov-report html --cov emails {posargs}
6+
commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg {posargs}
77

88
[testenv:pypy]
99
deps =
@@ -30,6 +30,27 @@ deps =
3030
-rrequirements/tests.txt
3131

3232

33+
[testenv:django42]
34+
basepython = python3.12
35+
deps =
36+
-rrequirements/tests-django.txt
37+
Django>=4.2,<4.3
38+
commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg -m django {posargs}
39+
40+
[testenv:django52]
41+
basepython = python3.12
42+
deps =
43+
-rrequirements/tests-django.txt
44+
Django>=5.2,<5.3
45+
commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg -m django {posargs}
46+
47+
[testenv:django60]
48+
basepython = python3.12
49+
deps =
50+
-rrequirements/tests-django.txt
51+
Django>=6.0,<6.1
52+
commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg -m django {posargs}
53+
3354
[testenv:typecheck]
3455
deps = mypy
3556
commands = mypy emails/

0 commit comments

Comments
 (0)