Add support for pytest

This commit is contained in:
Jim Fingal 2020-11-08 12:14:57 -08:00
parent 58237b6984
commit 0b8a9cf1a6
5 changed files with 18 additions and 1 deletions

2
.coveragerc Normal file
View file

@ -0,0 +1,2 @@
[run]
omit = */test*,celerywyrm*,bookwyrm/migrations/*

View file

@ -22,6 +22,7 @@ services:
- main
web:
build: .
env_file: .env
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/app

9
fr-dev
View file

@ -46,6 +46,9 @@ case "$1" in
migrate)
runweb python manage.py migrate
;;
bash)
runweb bash
;;
shell)
runweb python manage.py shell
;;
@ -59,6 +62,10 @@ case "$1" in
shift 1
runweb coverage run --source='.' --omit="*/test*,celerywyrm*,bookwyrm/migrations/*" manage.py test "$@"
;;
pytest)
shift 1
runweb pytest "$@"
;;
test_report)
runweb coverage report
;;
@ -72,6 +79,6 @@ case "$1" in
clean
;;
*)
echo "Unrecognised command. Try: build, clean, up, initdb, resetdb, makemigrations, migrate, shell, dbshell, restart_celery, test, test_report"
echo "Unrecognised command. Try: build, clean, up, initdb, resetdb, makemigrations, migrate, bash, shell, dbshell, restart_celery, test, pytest, test_report"
;;
esac

4
pytest.ini Normal file
View file

@ -0,0 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE = bookwyrm.settings
python_files = tests.py test_*.py *_tests.py
addopts = --cov=bookwyrm --cov-config=.coveragerc

View file

@ -8,6 +8,9 @@ Pillow>=7.1.0
psycopg2==2.8.4
pycryptodome==3.9.4
python-dateutil==2.8.1
pytest_django==4.1.0
pytest==6.1.2
pytest-cov==2.10.1
redis==3.4.1
requests==2.22.0
responses==0.10.14