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

Commit 6db17c3

Browse files
committed
Improve testing setup
1 parent 04af165 commit 6db17c3

File tree

11 files changed

+146
-25
lines changed

11 files changed

+146
-25
lines changed

.circleci/config.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ jobs:
2929
- '.venv'
3030
- '/usr/local/bin'
3131
- '/usr/local/lib/python3.7/site-packages'
32-
- run:
33-
name: Run black
34-
command: pipenv run black --check .
35-
- run:
36-
name: Run isort
37-
command: pipenv run isort --recursive --check-only --diff
38-
- run:
39-
name: Run flake8
40-
command: pipenv run flake8
4132
- run:
4233
name: Run tests
43-
command: pipenv run pytest
34+
command: pipenv run python runtests.py

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ If you want to go the usual route and run the project locally, though:
8787
- Install pre-commit hooks: `pipenv run pre-commit install`
8888
- Setup environment file: `cp example.env .env`
8989
- Install docker-compose: https://docs.docker.com/compose/install/
90-
- Build and start containers, including test container: `docker-compose up -d`
90+
- Build and start containers, including test container: `docker-compose up --build -d`
9191
- Create super user: `docker-compose exec web python manage.py createsuperuser`
9292
- Scrape some contracts: `docker-compose exec web python manage.py scrape_contracts --limit 100`
9393
- open http://localhost:8000
9494

9595
And you should be ready to go!
9696

97-
You can use this command to run tests on demand: `docker-compose up test`
97+
You can use this command to run tests on demand: `docker-compose run tests`
9898

9999
## Contribute Documentation
100100

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ FROM python:3.7
2424
ARG PIPENV_ARGS
2525

2626
ENV LANG en_US.utf8
27+
ENV PYTHONUNBUFFERED 1
2728

2829
RUN pip install pipenv==2018.11.26
2930

Pipfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ verify_ssl = true
44
name = "pypi"
55

66
[dev-packages]
7-
black = "*"
7+
black = "==19.3b0"
88
isort = "==4.3.4"
9-
"flake8" = "*"
10-
pre-commit = "*"
9+
"flake8" = "==3.7.7"
10+
pre-commit = "==1.15.1"
1111
seed-isort-config = "==1.6.0"
12-
pytest-django = "*"
12+
pytest-django = "==3.4.8"
1313

1414
[packages]
1515
dj-database-url = "==0.5.0"

Pipfile.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/docker-entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ case "$1" in
3535
;;
3636

3737
"run-tests")
38-
pytest
38+
python runtests.py
3939
;;
4040

4141
*)

contratospr/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
from __future__ import absolute_import, unicode_literals
2+
13
from .tasks import app as celery_app # noqa
4+
5+
__all__ = ("celery_app",)

contratospr/settings.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,19 @@ def CACHES(self):
237237
}
238238
}
239239

240-
class Testing(Common):
241-
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
242240

243-
CELERY_TASK_IGNORE_RESULT = True
244-
CELERY_TASK_ALWAYS_EAGER = True
245-
CELERY_TASK_EAGER_PROPAGATES = True
241+
class Testing(Common):
242+
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
243+
244+
CELERY_TASK_IGNORE_RESULT = True
245+
CELERY_TASK_ALWAYS_EAGER = True
246+
CELERY_TASK_EAGER_PROPAGATES = True
247+
248+
SECRET_KEY = "dont-tell-eve"
249+
GOOGLE_APPLICATION_CREDENTIALS = ""
250+
AWS_ACCESS_KEY_ID = ""
251+
AWS_S3_BUCKET_NAME = ""
252+
AWS_SECRET_ACCESS_KEY = ""
246253

247254

248255
structlog.configure(

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ services:
7070
PIPENV_ARGS: --dev
7171
command: run-tests
7272
entrypoint: /app/bin/docker-entrypoint
73-
env_file:
74-
- .env
73+
environment:
74+
- DATABASE_URL=postgres://postgres:password@database/postgres
75+
- REDIS_URL=redis://redis:6379
7576
volumes:
7677
- .:/app
7778
links:

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[pytest]
22
DJANGO_CONFIGURATION=Testing
3+
DJANGO_SETTINGS_MODULE=contratospr.settings

0 commit comments

Comments
 (0)