Deprecate assertQueries() in favor of django_assert_queries.

Review Request #14335 — Created Feb. 6, 2025 and updated

Information

Djblets
release-5.x

Reviewers

A while back, we split out TestCase.assertQueries(),
djblets.db.query_catcher, and djblets.db.query_comparator into an
independent package, django_assert_queries, making these assertions
available outside of projects consuming Djblets.

Until now, the code was the same between the two, but advancements have
since been made in that project. Given that, we're no longer shipping a
separate copy, and instead recommending that package instead.

This will go through a standard deprecation period. We now depend on
django_assert_queries and re-export the appropriate modules for
compatibility purposes.

TestCase.assertQueries() will continue to work, with a deprecation
warning. All new code should use
django_assert_queries.assert_queries() instead. In time, that will
allow us to remove this as a hard dependency of Djblets, and keep it a
development-time dependency.

Unit tests pass in Djblets and Review Board.

Summary ID
Deprecate assertQueries() in favor of django_assert_queries.
A while back, we split out `TestCase.assertQueries()`, `djblets.db.query_catcher`, and `djblets.db.query_comparator` into an independent package, `django_assert_queries`, making these assertions available outside of projects consuming Djblets. Until now, the code was the same between the two, but advancements have since been made in that project. Given that, we're no longer shipping a separate copy, and instead recommending that package instead. This will go through a standard deprecation period. We now depend on `django_assert_queries` and re-export the appropriate modules for compatibility purposes. `TestCase.assertQueries()` will continue to work, with a deprecation warning. All new code should use `django_assert_queries.assert_queries()` instead. In time, that will allow us to remove this as a hard dependency of Djblets, and keep it a development-time dependency.
b122bf4000374425904d26c3a786da90336d9b91
Description From Last Updated

'django_assert_queries.CompareQueriesContext' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

'django_assert_queries.QueryMismatchedAttr' imported but unused Column: 5 Error code: F401

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

flake8

david
  1. Once Review Bot is happy, I am too.

  2.