diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml index ca17cbd..7df7ba8 100644 --- a/.gitea/workflows/build-and-publish.yaml +++ b/.gitea/workflows/build-and-publish.yaml @@ -46,10 +46,19 @@ jobs: python-version: 3.12 - name: Install test dependencies - run: python -m pip install --upgrade pip && pip install -r requirements.txt + run: python -m pip install --upgrade pip && pip install -r requirements-dev.txt + + - name: Cache pip dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: "$RUNNER_OS-pip-${{ hashFiles('requirements-dev.txt') }}" + restore-keys: | + $RUNNER_OS-pip- - name: Run unit tests - run: pytest -q + run: python -m pytest -q + - name: Determine registry host run: echo "REGISTRY=${GITHUB_SERVER_URL#*://}" >> "$GITHUB_ENV" diff --git a/README.md b/README.md index 0a89b3e..4ad7a25 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,13 @@ docker run --rm -p 110:110 -p 25:25 \ ## Tests -Run tests locally with: +Install development dependencies and run the test suite: ```bash +python -m venv .venv +source .venv/bin/activate python -m pip install --upgrade pip -pip install -r requirements.txt +pip install -r requirements-dev.txt pytest -q ``` diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..07ead03 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +minversion = 7.0 +testpaths = tests +python_files = test_*.py +addopts = -q diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..13f6026 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +-r requirements.txt +pytest>=8.0.0 diff --git a/requirements.txt b/requirements.txt index 0bc8eef..0ffd319 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ aiosmtpd>=1.4.6,<1.5 -pytest>=8.0.0