mirror of
https://github.com/django/django.git
synced 2024-11-21 19:09:18 +01:00
Refs #12581 -- Adjusted warning stacklevel in queries ring buffer.
This commit is contained in:
parent
2b9f0b79bc
commit
5e81a4e790
@ -175,7 +175,8 @@ class BaseDatabaseWrapper:
|
||||
if len(self.queries_log) == self.queries_log.maxlen:
|
||||
warnings.warn(
|
||||
"Limit for query logging exceeded, only the last {} queries "
|
||||
"will be returned.".format(self.queries_log.maxlen)
|
||||
"will be returned.".format(self.queries_log.maxlen),
|
||||
stacklevel=2,
|
||||
)
|
||||
return list(self.queries_log)
|
||||
|
||||
|
@ -558,8 +558,9 @@ class BackendTestCase(TransactionTestCase):
|
||||
"Limit for query logging exceeded, only the last 3 queries will be "
|
||||
"returned."
|
||||
)
|
||||
with self.assertWarnsMessage(UserWarning, msg):
|
||||
with self.assertWarnsMessage(UserWarning, msg) as ctx:
|
||||
self.assertEqual(3, len(new_connection.queries))
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
finally:
|
||||
BaseDatabaseWrapper.queries_limit = old_queries_limit
|
||||
|
Loading…
Reference in New Issue
Block a user