Update django-assert-queries to support up through Django 6.0

Review Request #14755 — Created Dec. 31, 2025 and submitted — Latest diff uploaded

Information

django-assert-queries
main

Reviewers

This change updates us to run on all versions of Django between 4.2 and
6.0, and Python between 3.10 and 3.14. These combinations have all been
added to the tox config.

There are a few fixes to support changes that occurred in Django 5.2 and
6.0:

  • The add_q method has additional parameters (in some cases) that we
    need to include on our spy in order for the signature to match.
  • Some subqueries have AS "pk" added to them in 5.2+
  • Django 6.0 seems to optimize out some subqueries, requiring a branch
    in the test expectations.

I've also added __test__ = False to TestModel to suppress pytest
warnings about collection.

Based in part on work by Petr Dlouhy at
https://github.com/beanbaginc/django-assert-queries/pull/3/

Ran unit tests on all supported combinations of Python and Django.

Commits

Files