Add subquery checks in assertQueries(), and improve output formatting.
Review Request #13372 — Created Oct. 23, 2023 and submitted
This updates
assertQueries()
to check for and compare subquery
information. This takes in aninner_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 throughpprint.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 |
---|---|
f422f1f0521da2cf74d835120cbf9642b18662d1 |
Description | From | Last Updated |
---|---|---|
'djblets.db.query_catcher.ExecutedQueryInfo' imported but unused Column: 1 Error code: F401 |
reviewbot | |
Should list check_subqueries here. |
david | |
Instead of "update your query expectations to begin migrating to these new checks", how about "update your query expectations to … |
david | |
Wording is off here. |
maubin |
- Change Summary:
-
Removed an unused import.
- Commits:
-
Summary ID 410a1b1b6c9d1209165ce35acc7f0bedd1c18d56 9a9a862db0afc865ee2cc5dc402a7c9d2716f2c4 - Diff:
-
Revision 2 (+294 -64)
Checks run (2 succeeded)
- Description:
-
This updates
assertQueries()
to check for and compare subqueryinformation. This takes in an inner_query
attribute that matches thequery 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. ~ 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 ifthe results span multiple lines, it will be formatted with proper indentation and alignment to help with reading the output.
- Change Summary:
-
Fixed a bug causing inner query matching to factor in outer query expectations.
- Commits:
-
Summary ID 9a9a862db0afc865ee2cc5dc402a7c9d2716f2c4 1ae87b3353227cfe617c039a17efa6b522c49a09 - Diff:
-
Revision 3 (+326 -86)
Checks run (2 succeeded)
- Change Summary:
-
- Added
check_subqueries
to the list of changes forassertQueries()
. - Improved the warning message when a subquery is found when
check_subqueries
isn't on. - Improved a comment to help it make more sense.
- Added
- Commits:
-
Summary ID 1ae87b3353227cfe617c039a17efa6b522c49a09 f422f1f0521da2cf74d835120cbf9642b18662d1 - Diff:
-
Revision 4 (+326 -86)