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

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

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.

Changes between revision 2 and 3

orig
1
2
3
4

Commits

Summary ID Author
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.
9a9a862db0afc865ee2cc5dc402a7c9d2716f2c4 Christian Hammond
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.
1ae87b3353227cfe617c039a17efa6b522c49a09 Christian Hammond
djblets/testing/testcases.py
Loading...