Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 04af165

Browse files
committed
Tweak test/docker setup
1 parent c2e664f commit 04af165

File tree

8 files changed

+28
-47
lines changed

8 files changed

+28
-47
lines changed

Dockerfile.worker renamed to Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ RUN apt-get update && \
2121

2222
FROM python:3.7
2323

24+
ARG PIPENV_ARGS
25+
2426
ENV LANG en_US.utf8
2527

2628
RUN pip install pipenv==2018.11.26
@@ -31,7 +33,7 @@ COPY --from=builder /tmp/poppler/bin/pdftotext /usr/local/bin/
3133
COPY Pipfile Pipfile.lock /app/
3234

3335
# Install application requirements
34-
RUN pipenv install --deploy --system && \
36+
RUN pipenv install --deploy --system $PIPENV_ARGS && \
3537
rm -rf /root/.cache
3638

3739
# Bundle app source

Dockerfile.local

Lines changed: 0 additions & 15 deletions
This file was deleted.

Dockerfile.web

Lines changed: 0 additions & 19 deletions
This file was deleted.

bin/docker-entrypoint

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ case "$1" in
3434
./bin/worker --loglevel=DEBUG --concurrency=2
3535
;;
3636

37-
"start-test")
38-
pipenv run pytest
37+
"run-tests")
38+
pytest
3939
;;
4040

4141
*)

contratospr/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ def CACHES(self):
237237
}
238238
}
239239

240+
class Testing(Common):
241+
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
242+
243+
CELERY_TASK_IGNORE_RESULT = True
244+
CELERY_TASK_ALWAYS_EAGER = True
245+
CELERY_TASK_EAGER_PROPAGATES = True
246+
240247

241248
structlog.configure(
242249
processors=[

docker-compose.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ services:
2424
worker:
2525
build:
2626
context: .
27-
dockerfile: Dockerfile.worker
27+
dockerfile: Dockerfile
28+
args:
29+
PIPENV_ARGS: --dev
2830
command: start-worker
2931
entrypoint: /app/bin/docker-entrypoint
3032
restart: on-failure
@@ -39,7 +41,9 @@ services:
3941
web:
4042
build:
4143
context: .
42-
dockerfile: Dockerfile.web
44+
dockerfile: Dockerfile
45+
args:
46+
PIPENV_ARGS: --dev
4347
command: start-web
4448
entrypoint: /app/bin/docker-entrypoint
4549
restart: on-failure
@@ -58,18 +62,18 @@ services:
5862
timeout: 10s
5963
retries: 3
6064

61-
test:
65+
tests:
6266
build:
6367
context: .
64-
dockerfile: Dockerfile.local
65-
command: start-test
68+
dockerfile: Dockerfile
69+
args:
70+
PIPENV_ARGS: --dev
71+
command: run-tests
6672
entrypoint: /app/bin/docker-entrypoint
6773
env_file:
6874
- .env
6975
volumes:
7076
- .:/app
71-
ports:
72-
- '8000:8000'
7377
links:
7478
- database:database
75-
- redis:redis
79+
- redis:redis

heroku.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
build:
22
docker:
3-
web: Dockerfile.web
4-
worker: Dockerfile.worker
3+
web: Dockerfile
4+
worker: Dockerfile
55
release:
66
image: web
77
command:

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
DJANGO_CONFIGURATION=Testing

0 commit comments

Comments
 (0)