A Django library for recording and asserting performance characteristics of your code over time. It provides a Python context manager and Django test case mixin to record per-request SQL query counts and durations, template node counts, and response sizes. Version 4.31.0 supports Python 3.9+ and Django 3.2+. The project is actively maintained with a regular release cadence.
pip install django-perf-recVerified import paths — ran on the pinned version, not inferred.
Basic usage with RecordRequestsMixin to automatically record and assert database query counts and templates.
Ensure mixin order: class MyTestCase(RecordRequestsMixin, TestCase):
Upgrade to use RecordRequestsMixin for test classes or record_requests() for context managers.
Use assertNumQueries with the same signature.