django-slowtests

raw JSON →
1.1.1 verified Fri May 01 auth: no python

A Django test runner that identifies and reports your slowest tests. Version 1.1.1, stable but low maintenance.

pip install django-slowtests
error ImportError: No module named 'slowtests'
cause Trying to import from wrong module name.
fix
Use 'from django_slowtests.testrunner import SlowTestRunner'.
error AttributeError: 'TestRunner' object has no attribute 'slow_tests'
cause Incorrect test runner configuration or old Django version.
fix
Ensure TEST_RUNNER is 'django_slowtests.testrunner.SlowTestRunner' and Django >= 1.8.
gotcha The package does not support pytest; only works with Django's manage.py test.
fix Use pytest with --durations option instead.
gotcha The output can be verbose; use SLOW_TEST_THRESHOLD_MS to filter.
fix Set SLOW_TEST_THRESHOLD_MS to a value in milliseconds to only show tests above threshold.

Configure the test runner in settings.py, then run tests as usual.

# settings.py
TEST_RUNNER = 'django_slowtests.testrunner.SlowTestRunner'
SLOW_TEST_THRESHOLD_MS = 200  # optional

# run tests
# python manage.py test