diff --git a/chatmaild/pyproject.toml b/chatmaild/pyproject.toml index adce0217..9dfd147b 100644 --- a/chatmaild/pyproject.toml +++ b/chatmaild/pyproject.toml @@ -20,7 +20,7 @@ addopts = "-v -ra --strict-markers" legacy_tox_ini = """ [tox] isolated_build = true -envlist = lint +envlist = lint,py [testenv:lint] skipdist = True @@ -31,4 +31,10 @@ deps = commands = black --quiet --check --diff src/ ruff src/ + +[testenv] +passenv = CHATMAIL_DOMAIN +deps = pytest + pdbpp +commands = pytest -v -rsXx {posargs: ../tests/chatmaild} """ diff --git a/scripts/init.sh b/scripts/init.sh index c20bb21a..3e19cf36 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,13 +1,8 @@ #!/bin/sh set -e -python3 -m venv deploy-chatmail/venv -deploy-chatmail/venv/bin/pip install pyinfra pytest -deploy-chatmail/venv/bin/pip install -e deploy-chatmail -deploy-chatmail/venv/bin/pip install -e chatmaild +python3 -m venv venv +pip=venv/bin/pip -python3 -m venv chatmaild/venv -chatmaild/venv/bin/pip install --upgrade pytest build 'setuptools>=68' -chatmaild/venv/bin/pip install -e chatmaild - -python3 -m venv online-tests/venv -online-tests/venv/bin/pip install pytest pytest-timeout pdbpp deltachat +$pip install pyinfra pytest build 'setuptools>=68' tox +$pip install -e deploy-chatmail +$pip install -e chatmaild diff --git a/scripts/test.sh b/scripts/test.sh index e7ce0a4b..53c93122 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,3 +1,11 @@ #!/bin/bash -chatmaild/venv/bin/pytest chatmaild/ $@ -online-tests/venv/bin/pytest online-tests/ -vrx --durations=5 $@ + +pushd chatmaild +tox +popd + +pushd deploy-chatmail +tox +popd + +venv/bin/pytest tests/online -vrx --durations=5 $@ diff --git a/tests/chatmaild/test_filtermail.py b/tests/chatmaild/test_filtermail.py index 1965f49e..13b0c92f 100644 --- a/tests/chatmaild/test_filtermail.py +++ b/tests/chatmaild/test_filtermail.py @@ -2,6 +2,12 @@ from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter import pytest +@pytest.fixture +def maildomain(): + # let's not depend on a real chatmail instance for the offline tests below + return "chatmail.example.org" + + def test_reject_forged_from(maildata, gencreds): class env: mail_from = gencreds()[0]