-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.pytest.yml
35 lines (32 loc) · 1.03 KB
/
docker-compose.pytest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Containerised pytest:
# $ docker-compose --file docker-compose.pytest.yml up --build pytest
version: "3"
services:
# Container providing Postgresql instance to pytest.
pytest-db:
# With no persistent volume, it's possible to clear the database contents by
# simply stopping this service: docker-compose stop pytest-db.
image: "postgres:16"
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
POSTGRES_USER: postgres
POSTGRES_DB: tamato
ports:
# Map a port from the host to allow inspection via DB clients, e.g.:
# $ psql --host=127.0.0.1 --port=5430 --username=postgres --dbname=tamato
- "127.0.0.1:5430:5432"
# Runs all tamato unit tests.
pytest:
build:
context: .
dockerfile: Dockerfile.pytest
image: pytest
depends_on:
- pytest-db
environment:
DATABASE_URL: postgres://postgres@pytest-db/tamato
DJANGO_SETTINGS_MODULE: settings.test
ENV: test
command: sh -c "python manage.py migrate && pytest"
stdin_open: true
tty: true