Expects to be in a sibling directory to the bandersnatch project root, e.g.:
- projects/
- bandersnatch/
- src/
- pyproject.toml
- ...
- bandersnatch-test/
- docker-compose.yml
- runner.Dockerfile
- install-pythons.sh
Technically this is adjustable by editing the bind mount in the volumes
configuration for test-runner
in the Docker Compose file.
docker compose up -d
Starts 2 services:
test-runner
: an Ubuntu base image with multiple versions of Python 3 availableblock-storage
: a default minio instance used as an S3-compatible object store when testing the S3 storage backend
Running pytest:
docker compose exec test-runner tox run
This runs unit tests for Python 3.11 and 3.12. The Python versions are controlled by this line in the Docker Compose file:
TOX_OVERRIDE: 'tox.envlist=py3.11,py3.12'
You can run specific versions with -e
:
docker compose exec test-runner tox run -e py3.11
And pass arguments to pytest by adding them after a --
:
docker compose exec test-runner tox run -- -m 'not s3'
Running the integration test script:
docker compose exec -e TOXENV=INTEGRATION test-runner tox exec \
-e py3.11 \
-x testenv.allowlist_externals=*.py \
-x testenv.pass_env+=TOXENV \
-- ./test_runner.py