Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Pending
* Dropped support for the Python 3.9, it has reached its end of life date.
* Toggle tracking the toolbar's queries when using
``debug_toolbar.store.DatabaseStore`` with ``SKIP_TOOLBAR_QUERIES``.
* Added test to confirm Django's ``TestCase.assertNumQueries`` works.

6.1.0 (2025-10-30)
------------------
Expand Down
11 changes: 11 additions & 0 deletions tests/panels/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ def test_recording(self):
# ensure the stacktrace is populated
self.assertTrue(len(query["stacktrace"]) > 0)

def test_assert_num_queries_works(self):
"""
Confirm Django's assertNumQueries and CaptureQueriesContext works

See https://github.com/django-commons/django-debug-toolbar/issues/1791
"""
self.assertEqual(len(self.panel._queries), 0)
with self.assertNumQueries(1):
sql_call()
self.assertEqual(len(self.panel._queries), 1)

async def test_recording_async(self):
self.assertEqual(len(self.panel._queries), 0)

Expand Down
Loading