Move the assertQueries comparison code into a dedicated module.

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

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.

Summary ID
Move the assertQueries comparison code into a dedicated module.
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 login. This merely lays the groundwork for upcoming work on comparisons. `assertQueries()` has been updated to use this, and has reduced in size considerably.
d964531a39a993ac75aa55bf8fcf44a10f73b93f
Description From Last Updated

Typo in description: "login" -> "logic"

maubinmaubin
chipx86
maubin
  1. 
      
  2. Show all issues

    Typo in description: "login" -> "logic"

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

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (84a8bd2)
Loading...