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

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

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.

Diff Revision 2

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
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`.
a39c41f81731f94a64d3360945c6aea3a6b9ff90 Christian Hammond
djblets/db/query_catcher.py
djblets/db/tests/test_query_catcher.py
djblets/testing/testcases.py
docs/djblets/conf.py
docs/djblets/coderef/index.rst
Loading...