Move the assertQueries comparison code into a dedicated module.

Review Request #13396 — Created Nov. 2, 2023 and submitted — Latest diff uploaded

Information

Djblets
release-3.x

Reviewers

This introduces djblets.db.query_comparator, which contains the query
comparison code from assertQueries(). This was moved out in order to
help make the code more maintainable, as it will soon need to grow in
size in order to handle ORM sub-expressions, and it was already pretty
large to begin with.

Since we're starting fresh, some renames were made. Instead of
"failures", we now describe results in terms of "mismatches", to help
differentiate from a query that fails to execute.

The inner functions have been made outer functions, avoiding the need to
redefine them when asserting.

Otherwise, nothing has really changed about the assertion logic. This
merely lays the groundwork for upcoming work on comparisons.

assertQueries() has been updated to use this, and has reduced in size
considerably.

Given some of the renames, this does break typing compatibility with
newer code, but not with anything that has been released. The affected
code will be updated to use the new type imports.

Unit tests pass.

Commits

Files

    Loading...