File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -622,8 +622,8 @@ def _assert_num_queries(
622622 * ,
623623 using : str | None = None ,
624624) -> Generator [django .test .utils .CaptureQueriesContext , None , None ]:
625- from django .db import connections
626625 from django .db import connection as default_conn
626+ from django .db import connections
627627 from django .test .utils import CaptureQueriesContext
628628
629629 if connection and using :
Original file line number Diff line number Diff line change @@ -216,10 +216,8 @@ def test_django_assert_num_queries_db_using(
216216 with django_assert_num_queries (1 , using = "default" ):
217217 Item .objects .create (name = "foo" )
218218
219- with django_assert_num_queries (1 , using = "default" , connection = connection ):
220- Item .objects .create (name = "foo" )
221-
222- with pytest .raises (ValueError ):
219+ error_message = 'The "connection" and "using" parameter cannot be used together'
220+ with pytest .raises (ValueError , match = error_message ):
223221 with django_assert_num_queries (1 , connection = connection , using = "default" ):
224222 Item .objects .create (name = "foo" )
225223
You can’t perform that action at this time.
0 commit comments