File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Pending
1414* Dropped support for the Python 3.9, it has reached its end of life date.
1515* Toggle tracking the toolbar's queries when using
1616 ``debug_toolbar.store.DatabaseStore `` with ``SKIP_TOOLBAR_QUERIES ``.
17+ * Added test to confirm Django's ``TestCase.assertNumQueries `` works.
1718
18196.1.0 (2025-10-30)
1920------------------
Original file line number Diff line number Diff line change @@ -102,6 +102,17 @@ def test_recording(self):
102102 # ensure the stacktrace is populated
103103 self .assertTrue (len (query ["stacktrace" ]) > 0 )
104104
105+ def test_assert_num_queries_works (self ):
106+ """
107+ Confirm Django's assertNumQueries and CaptureQueriesContext works
108+
109+ See https://github.com/django-commons/django-debug-toolbar/issues/1791
110+ """
111+ self .assertEqual (len (self .panel ._queries ), 0 )
112+ with self .assertNumQueries (1 ):
113+ sql_call ()
114+ self .assertEqual (len (self .panel ._queries ), 1 )
115+
105116 async def test_recording_async (self ):
106117 self .assertEqual (len (self .panel ._queries ), 0 )
107118
You can’t perform that action at this time.
0 commit comments