diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 577d8b799..74bc0f7b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,7 @@ test_api: - cd api - pip install -r requirements/test.txt script: - - export DJANGO_SETTINGS_MODULE=config.settings.test - - python manage.py test + - pytest tags: - docker diff --git a/api/pytest.ini b/api/pytest.ini new file mode 100644 index 000000000..4ab907403 --- /dev/null +++ b/api/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +DJANGO_SETTINGS_MODULE=config.settings.test + +# -- recommended but optional: +python_files = tests.py test_*.py *_tests.py diff --git a/api/requirements/test.txt b/api/requirements/test.txt index 93509c573..a26cf5bdb 100644 --- a/api/requirements/test.txt +++ b/api/requirements/test.txt @@ -5,3 +5,7 @@ flake8==2.5.0 model-mommy==1.3.2 tox==2.7.0 +pytest +pytest-django +pytest-sugar +pytest-xdist diff --git a/api/runtests b/api/runtests index bd8db7a84..48e7b8267 100755 --- a/api/runtests +++ b/api/runtests @@ -2,4 +2,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -docker-compose -f $DIR/test.yml run test python manage.py test "$@" +docker-compose -f $DIR/test.yml run test pytest "$@" diff --git a/api/test.yml b/api/test.yml index dc50a9b54..6215e27de 100644 --- a/api/test.yml +++ b/api/test.yml @@ -1,8 +1,6 @@ test: dockerfile: docker/Dockerfile.test build: . - command: python manage.py test + command: pytest volumes: - .:/app - environment: - - DJANGO_SETTINGS_MODULE=config.settings.test