The main intention of the anfema_django_testutils
app is to provide a Django test runner which considers
snapshot tests as well as code coverage and human-readable html test reports. Moreover, the test result
Precondition Failure
has been added.
This package integrates snapshottest as well as coverage.
- Source available at: https://github.com/anfema/anfema-django-testutils
- Documentation available at: https://anfema.github.io/anfema-django-testutils
anfema_django_testutils
is officially supported on:
- Python >= 3.9
- Django >= 3.2
$ pip install anfema-django-testutils
Update your Django settings.py
to use the anfema_django_testutils
test runner:
# settings.py
INSTALLED_APPS = [
...
"mathfilters",
"anfema_django_testutils",
]
TEST_RUNNER = "anfema_django_testutils.runner.TestRunner"
For further information see the anfema_django_testutils
documentation.
For writing test cases use the anfema_django_testutils.testcases.TestCase
rather than the django.test.TestCase
:
# app/tests.py
from anfema_django_testutils.testcases import TestCase
class CustomTest(TestCase):
...
To generate the anfema_django_testutils
documentation from the local sources, run in a terminal:
$ pip install tox
$ tox -e docs -- docs/build
To execute the anfema_django_testutils
tests, run in a terminal:
$ pip install tox
$ tox
Licensed under the MIT-clause license; see LICENSE
for details.