Skip to content

Provides a Django TransactionTestCase.assertMaxNumQueries(), analogous to the existing TransactionTestCase.assertNumQueries()

License

Notifications You must be signed in to change notification settings

prismaticd/django-assertmaxnumqueries

Repository files navigation

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.

About

Provides a Django TransactionTestCase.assertMaxNumQueries(), analogous to the existing TransactionTestCase.assertNumQueries()

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published