Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 1.96 KB

README.rst

File metadata and controls

56 lines (34 loc) · 1.96 KB

Django AssertMaxNumQueries

Documentation Status Updates
Provides a mixin and TransactionTestCase subclass with assertMaxNumQueries(),
analogous to django.test.TransactionTestCase.assertNumQueries

Usage

Usage is identical to django.test.TransactionTestCase.assertNumQueries , except check on the number of queries is assertLessEqual insert of assertEqual.

To use Django AssertMaxNumQueries in a project:

import django_assertmaxnumqueries


class MyTestCase(django_assertmaxnumqueries.TransactionTestCase):

    def test_my_test(self):
        with self.assertMaxNumQueries(2):
            Person.objects.create(name="Aaron")
            Person.objects.create(name="Daniel")

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.