Compare commits

...

5 Commits

Author SHA1 Message Date
link2xt
77727e259e Use tox -c option 2023-10-22 11:49:25 +00:00
link2xt
732fdb3dab Setup deltachat dependency in init.sh 2023-10-22 11:47:40 +00:00
holger krekel
fe648f4784 run tests via scripts 2023-10-21 12:51:30 +02:00
holger krekel
d43e046c5d try to run all offline tests in CI 2023-10-21 12:49:05 +02:00
holger krekel
3716f2e429 fix init.sh and test.sh
use tox for chatmaild non-online tests
2023-10-21 12:22:21 +02:00
5 changed files with 38 additions and 17 deletions

View File

@@ -5,14 +5,27 @@ on:
push: push:
jobs: jobs:
lint: tox:
name: Lint name: chatmail tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Lint chatmaild - name: run chatmaild tests
working-directory: chatmaild working-directory: chatmaild
run: pipx run tox run: pipx run tox
- name: Lint deploy-chatmail - name: run deploy-chatmail offline tests
working-directory: deploy-chatmail working-directory: deploy-chatmail
run: pipx run tox run: pipx run tox
- name: run deploy-chatmail offline tests
working-directory: deploy-chatmail
run: pipx run tox
scripts:
name: chatmail script invocations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: run init.sh
run: ./scripts/init.sh
- name: run test.sh
run: ./scripts/test.sh

View File

@@ -20,7 +20,7 @@ addopts = "-v -ra --strict-markers"
legacy_tox_ini = """ legacy_tox_ini = """
[tox] [tox]
isolated_build = true isolated_build = true
envlist = lint envlist = lint,py
[testenv:lint] [testenv:lint]
skipdist = True skipdist = True
@@ -31,4 +31,10 @@ deps =
commands = commands =
black --quiet --check --diff src/ black --quiet --check --diff src/
ruff src/ ruff src/
[testenv]
passenv = CHATMAIL_DOMAIN
deps = pytest
pdbpp
commands = pytest -v -rsXx {posargs: ../tests/chatmaild}
""" """

View File

@@ -1,13 +1,8 @@
#!/bin/sh #!/bin/sh
set -e set -e
python3 -m venv deploy-chatmail/venv python3 -m venv venv
deploy-chatmail/venv/bin/pip install pyinfra pytest pip=venv/bin/pip
deploy-chatmail/venv/bin/pip install -e deploy-chatmail
deploy-chatmail/venv/bin/pip install -e chatmaild
python3 -m venv chatmaild/venv $pip install pyinfra pytest build 'setuptools>=68' tox deltachat
chatmaild/venv/bin/pip install --upgrade pytest build 'setuptools>=68' $pip install -e deploy-chatmail
chatmaild/venv/bin/pip install -e chatmaild $pip install -e chatmaild
python3 -m venv online-tests/venv
online-tests/venv/bin/pip install pytest pytest-timeout pdbpp deltachat

View File

@@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
chatmaild/venv/bin/pytest chatmaild/ $@ tox -c chatmaild
online-tests/venv/bin/pytest online-tests/ -vrx --durations=5 $@ tox -c deploy-chatmail
venv/bin/pytest tests/online -vrx --durations=5 $@

View File

@@ -2,6 +2,12 @@ from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter
import pytest 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): def test_reject_forged_from(maildata, gencreds):
class env: class env:
mail_from = gencreds()[0] mail_from = gencreds()[0]