From ccbaa15a67e596b3191f2544564a241e3edd1f4d Mon Sep 17 00:00:00 2001 From: abhiabhi94 <13880786+abhiabhi94@users.noreply.github.com> Date: Thu, 11 Mar 2021 18:03:40 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Switch=20to=20pytest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.rst | 2 +- setup.cfg | 4 ++++ testapp/requirements.txt | 3 ++- tox.ini | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 4181c3c..7afca01 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -38,7 +38,7 @@ To run tests against a particular ``python`` and ``django`` version installed in .. code:: sh - (venv) $ python manage.py test + (venv) $ pytest To run tests against all supported ``python`` and ``django`` versions, you may run: diff --git a/setup.cfg b/setup.cfg index 32812e7..0097827 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,3 +7,7 @@ extend-ignore = [isort] known_third_party = django, rest_framework +[tool:pytest] +DJANGO_SETTINGS_MODULE = testapp.settings +# Standard pytest options +addopts = -p no:warnings --reuse-db diff --git a/testapp/requirements.txt b/testapp/requirements.txt index c3b0801..bf7f15d 100644 --- a/testapp/requirements.txt +++ b/testapp/requirements.txt @@ -1,6 +1,7 @@ django djangorestframework -coverage flake8 tox Pillow +pytest-django +pytest-cov diff --git a/tox.ini b/tox.ini index 714b5dd..75a742a 100644 --- a/tox.ini +++ b/tox.ini @@ -19,10 +19,11 @@ DJANGO = [testenv] deps = - coverage flake8 Pillow djangorestframework + pytest-django + pytest-cov dj21: Django>=2.1,<2.2 dj22: Django>=2.2,<2.3 dj30: Django>=3.0,<3.1 @@ -35,8 +36,7 @@ commands = python -m pip install --upgrade pip flake8 python manage.py migrate - coverage run manage.py test - coverage report -m --skip-covered + pytest --cov setenv = PYTHONDONTWRITEBYTECODE=1