Skip to content

Commit 88520be

Browse files
committed
tests: Add docker container and script for tests
Additions: - /docker/Dockerfile.test which runs the tests inside a linux container with python 3.10 - /scripts/run_tests.sh runs the above Documentation: - How to use the above
1 parent b9c454c commit 88520be

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

CONTRIBUTING.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ We use `inline-snapshot` for E2E and integration tests, to prevent unexpected ch
2525

2626
If pytest terminates before reporting the test failures, it likely hit a case where mutmut calls `os._exit(...)`. Try looking at these calls first for troubleshooting.
2727

28+
Running the tests in a container
29+
--------------------------------
30+
31+
Tests are run in CI using a Linux container, if you are not running natively on Linux, you can run the tests in a container using the following script:
32+
33+
.. code-block:: console
34+
35+
./scripts/run_tests.sh
36+
2837
Running your local version of Mutmut against a test codebase
2938
------------------------------------------------------------
3039

docker/Dockerfile.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3.10.19-slim-trixie AS base
2+
3+
WORKDIR /mutmut
4+
5+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
6+
7+
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
8+
9+
COPY . .
10+
11+
RUN uv sync --group dev
12+
13+
ENTRYPOINT ["uv", "run", "pytest"]
14+
CMD ["--verbose"]

scripts/run_tests.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
cd "$(dirname "$0")/.."
4+
docker build -t mutmut -f ./docker/Dockerfile.test .
5+
docker run --rm -t -v "$(pwd)":/mutmut mutmut "$@"

0 commit comments

Comments
 (0)