Split assertQueries's query capturing into a new utility function.

Review Request #13371 — Created Oct. 23, 2023 and submitted

Information

Djblets
release-3.x

Reviewers

This introduces djblets.db.query_catcher.catch_queries(), which
contains the query capturing logic from assertQueries(). Through this,
we now have a formal interface for query capturing that can be
maintained separately from assertQueries(), simplifying that logic
considerably.

With this being a utility function, it's now easier to introspect
queries during development and debug code without having to do the work
from within a unit test. This is very helpful when performance-tuning as
an alternative to checking django.db.connection.queries.

assertQueries() has been updated to use this.

All Djblets and Review Board unit tests pass.

Summary ID
Split assertQueries's query capturing into a new utility function.
This introduces `djblets.db.query_catcher.catch_queries()`, which contains the query capturing logic from `assertQueries()`. Through this, we now have a formal interface for query capturing that can be maintained separately from `assertQueries()`, simplifying that logic considerably. With this being a utility function, it's now easier to introspect queries during development and debug code without having to do the work from within a unit test. This is very helpful when performance-tuning as an alternative to checking `django.db.connection.queries`.
f35e140963db1730f0dccfd26f8c40fb95873e9e
Description From Last Updated

'traceback' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'django.contrib.auth.models.Permission' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'django.contrib.auth.models.User' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

redefinition of unused 'test_with_delete' from line 103 Column: 5 Error code: F811

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (7b6fac9)
Loading...