Skip to content

Commit

Permalink
Fix django setup with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roel-devries committed Nov 17, 2023
1 parent e20699f commit 14d183c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.9-bookworm

RUN useradd --user-group --system datapunt
RUN apt-get update && apt install -y libgdal32

WORKDIR /app
COPY . ./
RUN pip install -e ".[django,tests]"
Expand Down
17 changes: 16 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
database:
image: amsterdam/postgres11
ports:
- "5415:5432"
- "5498:5432"
environment:
POSTGRES_DB: dataservices
POSTGRES_USER: dataservices
Expand All @@ -26,3 +26,18 @@ services:
- ".:/app"
command: >
bash
test:
build: .
depends_on:
- database
environment:
SECRET_KEY: insecure
# In order to use local datasets
SCHEMA_URL: /tmp/ams-schema/datasets
DATABASE_URL: "postgresql://dataservices:insecure@database/dataservices"
env_file: .env
volumes:
- ".:/app"
command: >
pytest tests
2 changes: 1 addition & 1 deletion tests/django/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def pytest_configure(config):
SCHEMA_DEFS_URL=env.str("SCHEMA_DEFS_URL", "https://schemas.data.amsterdam.nl/schema"),
AMSTERDAM_SCHEMA={"geosearch_disabled_datasets": []},
)
_setup_django()
_setup_django(config)

import tests.django.fixtures

Expand Down

0 comments on commit 14d183c

Please sign in to comment.