diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 217e777..a81737f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,7 +34,32 @@ jobs: python -m pip install -U pip - run: pip install tox - name: run tests - run: tox -e ${{ matrix.tox }} -- -m "not e2e" + run: tox -e ${{ matrix.tox }} -- -m "not e2e and not django" + + django: + name: "django / ${{ matrix.django }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - {django: '4.2', tox: django42} + - {django: '5.2', tox: django52} + - {django: '6.0', tox: django60} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: pip + - name: update pip + run: | + pip install -U wheel + pip install -U setuptools + python -m pip install -U pip + - run: pip install tox + - name: run django tests + run: tox -e ${{ matrix.tox }} typecheck: name: "typecheck" diff --git a/emails/testsuite/django_/test_django_integrations.py b/emails/testsuite/django_/test_django_integrations.py index 006a64e..199295b 100644 --- a/emails/testsuite/django_/test_django_integrations.py +++ b/emails/testsuite/django_/test_django_integrations.py @@ -1,8 +1,13 @@ import warnings +import pytest import emails import emails.message + +django = pytest.importorskip("django") from emails.django import DjangoMessage +pytestmark = pytest.mark.django + def test_django_message_proxy(django_email_backend): diff --git a/requirements/tests-django.txt b/requirements/tests-django.txt new file mode 100644 index 0000000..a4897ed --- /dev/null +++ b/requirements/tests-django.txt @@ -0,0 +1,2 @@ +--requirement=base.txt +--requirement=tests-base.txt diff --git a/setup.cfg b/setup.cfg index b3840e7..727ab7c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,6 +37,7 @@ ignore_errors = true norecursedirs = .* {arch} *.egg *.egg-info dist build requirements markers = e2e: tests that require a running SMTP server + django: tests that require Django [coverage:run] omit = emails/testsuite/* diff --git a/tox.ini b/tox.ini index 83d7093..4ae67e5 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = py310, py311, py312, py313, py314, pypy, style [testenv] passenv = TEST_*,SMTP_TEST_* -commands = py.test --cov-report term --cov-report html --cov emails {posargs} +commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg {posargs} [testenv:pypy] deps = @@ -30,6 +30,27 @@ deps = -rrequirements/tests.txt +[testenv:django42] +basepython = python3.12 +deps = + -rrequirements/tests-django.txt + Django>=4.2,<4.3 +commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg -m django {posargs} + +[testenv:django52] +basepython = python3.12 +deps = + -rrequirements/tests-django.txt + Django>=5.2,<5.3 +commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg -m django {posargs} + +[testenv:django60] +basepython = python3.12 +deps = + -rrequirements/tests-django.txt + Django>=6.0,<6.1 +commands = py.test --cov-report term --cov-report html --cov emails --cov-config=setup.cfg -m django {posargs} + [testenv:typecheck] deps = mypy commands = mypy emails/