Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -15,6 +15,7 @@ Pending
* Toggle tracking the toolbar's queries when using
``debug_toolbar.store.DatabaseStore`` with ``SKIP_TOOLBAR_QUERIES``.
* Fixed font family for code blocks and stack traces in the toolbar.
* 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