Add subquery checks in assertQueries(), and improve output formatting.

Review Request #13372 — Created Oct. 23, 2023 and submitted

Information

Djblets
release-3.x

Reviewers

This updates assertQueries() to check for and compare subquery
information. This takes in an inner_query attribute that matches the
query comparison dictionary and checks against it.

This wasn't supported before, and because of that, this support must be
optional or we'll break existing tests. Currently, consumers can pass in
check_subqueries=True to enable this. That will be the default in
Djblets 5. For now, if a subquery is found and no explicit
check_subqueries value is provided, a deprecation warning will be
emitted.

Formatting has also improved, in part to help output subquery comparison
details. All values are now passed through pprint.pformat(), and if
the results span multiple lines, it will be formatted with proper
indentation and alignment to help with reading the output.

All Djblets and Review Board unit tests pass.

Summary ID
Add subquery checks in assertQueries(), and improve output formatting.
This updates `assertQueries()` to check for and compare subquery information. This takes in an `inner_query` attribute that matches the query comparison dictionary and checks against it. This wasn't supported before, and because of that, this support must be optional or we'll break existing tests. Currently, consumers can pass in `check_subqueries=True` to enable this. That will be the default in Djblets 5. Formatting has also improved, in part to help output subquery comparison details. All values are now passed through `pprint.pformat()`, and if the results span multiple lines, it will be formatted with proper indentation and alignment to help with reading the output.
f422f1f0521da2cf74d835120cbf9642b18662d1
Description From Last Updated

'djblets.db.query_catcher.ExecutedQueryInfo' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

Should list check_subqueries here.

daviddavid

Instead of "update your query expectations to begin migrating to these new checks", how about "update your query expectations to …

daviddavid

Wording is off here.

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

flake8

chipx86
chipx86
chipx86
david
  1. 
      
  2. djblets/testing/testcases.py (Diff revision 3)
     
     

    Should list check_subqueries here.

  3. djblets/testing/testcases.py (Diff revision 3)
     
     
     

    Instead of "update your query expectations to begin migrating to these new checks", how about "update your query expectations to include the subquery"?

  4. 
      
maubin
  1. 
      
  2. djblets/testing/testcases.py (Diff revision 3)
     
     

    Wording is off here.

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

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (0774909)
Loading...