django_bench_runner - Locate slow tests
Django Bench Runner is a drop-in enhancement of the default django test runner that times how long it takes to run individual tests. It helps detect tests that might need optimization.
Installation
pip install django-bench-runner
In settings.py, add:
TEST_RUNNER = 'django_bench_runner.runner.BenchRunner'
Usage
Add the -b (or --benchmark) flag when running your tests.
Colorization
Tests that run under .5 seconds are colored green. The resulting tests are divvied into 3 groups. The fastest third (yellow), the middle third (magenta), and the slowest third (red). Red tests do not mean the tests are necessarily bad or in critical need of a speedup. It is just a graphical way to identify the various times of the tests.
Example Output
$ ./manage.py test core.tests.test_transfer_money -b --keepdb Using existing test database for alias 'default'... .. Test Runtime Percent -------------------------------------------------------------- --------- --------- core.tests.test_transfer_money.TestReleaseAmounts : test_wells_fargo 8.25052 47.81% : test_wells_fargo_exempt_from_prefunding 9.00663 52.19% --------------------------- ------- ------- TestReleaseAmounts 17.25715 100.00% ---------------------------------------------------------------------- Ran 2 tests in 17.262s OK
Django compatibility
Tested and working in Django 1.8 and 1.9.
Credits
Special thanks Sergey Astanin for `tabulate <https://pypi.python.org/pypi/tabulate>`__
Metadata
Release files for django_bench_runner 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_bench_runner-0.1.1.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_bench_runner-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 27.3 kB
Release files / django_bench_runner-0.1.1.tar.gz
| Download URL | django_bench_runner-0.1.1.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1cf8417bc343e7951a37b48f408f10ab21c4c896ab2a8bfebe4b86a3f43bc34
|
|
BLAKE2b-256 checksum How to use checksums |
90f22bb2b42c90b778306a3a09f08826a91542c818f86991ba202b8bda843add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_bench_runner-0.1.1-py2.py3-none-any.whl
| Download URL | django_bench_runner-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
17692abd4fb26f94f84318b6cf759028be0a425fdab6023d3eeb7df0b0f996d0
|
|
BLAKE2b-256 checksum How to use checksums |
0a0fcb3208df5091d8efeccc04b4d6c8ec287956c03fd386ca305ac7c9ae7ace
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |