Skip to content

Commit 4869e9e

Browse files
committed
Local tests helpers
1 parent 99b2c32 commit 4869e9e

File tree

5 files changed

+53
-2
lines changed

5 files changed

+53
-2
lines changed

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM fkrull/multi-python as build
2+
ENV PYTHONUNBUFFERED 1
3+
ARG PIP_INDEX_URL
4+
ENV PIP_INDEX_URL ${PIP_INDEX_URL}
5+
RUN pip3 --no-cache install --upgrade pip
6+
COPY setup.py .
7+
COPY psqlextra/_version.py psqlextra/_version.py
8+
COPY README.md .
9+
RUN pip3 install .[test] .[analysis] --no-cache-dir --no-cache --prefix /python-packages --no-warn-script-location
10+
11+
FROM fkrull/multi-python
12+
ENV PROJECT_DIR /project
13+
WORKDIR $PROJECT_DIR
14+
ENV PYTHONUNBUFFERED 1
15+
COPY --from=build /python-packages /usr/local
16+
COPY . .

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
docker compose run --rm tests

docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: "3.7"
2+
3+
services:
4+
postgres:
5+
image: postgis/postgis:14-3.2
6+
ports:
7+
- "5435:5432"
8+
volumes:
9+
- pgdata:/var/lib/postgresql/data/:delegated
10+
environment:
11+
- POSTGRES_HOST_AUTH_METHOD=trust
12+
- POSTGRES_DB=psqlextra
13+
healthcheck:
14+
test: "pg_isready -h localhost -p 5432 -q -U postgres"
15+
interval: 3s
16+
timeout: 5s
17+
retries: 3
18+
19+
20+
tests:
21+
build:
22+
context: ./
23+
depends_on:
24+
- postgres
25+
command:
26+
"tox"
27+
28+
volumes:
29+
pgdata:

settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
99

1010
DATABASES = {
11-
'default': dj_database_url.config(default='postgres:///psqlextra'),
11+
'default': dj_database_url.config(default='postgresql://postgres/?user=postgres'),
1212
}
1313

1414
DATABASES['default']['ENGINE'] = 'psqlextra.backend'

tox.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[tox]
22
envlist = py36-dj{20,21,22,30,31,32}, py37-dj{20,21,22,30,31,32}, py38-dj{20,21,22,30,31,32,40}, py39-dj{21,22,30,31,32,40}, py310-dj{21,22,30,31,32,40}
33

4+
; evaluation, flight_tracks
5+
;envlist = py37-dj{21}, py39-dj{32}
6+
7+
48
[testenv]
59
deps =
610
dj20: Django~=2.0.0
@@ -13,5 +17,5 @@ deps =
1317
.[test]
1418
setenv =
1519
DJANGO_SETTINGS_MODULE=settings
16-
passenv = DATABASE_URL
20+
passenv = postgresql://postgres:5432/?user=postgres
1721
commands = python setup.py test

0 commit comments

Comments
 (0)