test_classes: Improve assert_database_query_count output message.

Output message should talk about both the cases:
actual_count > expected_count and actual_count < expected_count.

The message now includes information for the case where
actual_query_count < expected_query_count.

Fixes: #23325
This commit is contained in:
Prakhar Pratyush 2022-10-24 11:34:32 +05:30 committed by Tim Abbott
parent 914712beab
commit 38aa1ee1ff
1 changed files with 3 additions and 2 deletions

View File

@ -1146,8 +1146,9 @@ Output:
{count} queries expected, got {actual_count}. {count} queries expected, got {actual_count}.
This is a performance-critical code path, where we check This is a performance-critical code path, where we check
the number of database queries used in order to avoid accidental regressions. the number of database queries used in order to avoid accidental regressions.
If the new query is necessary, you should update this test, If an unnecessary query was removed or the new query is necessary, you should
and explain in the pull request why adding an additional query can't be avoided.""" update this test, and explain what queries we added/removed in the pull request
and why any new queries can't be avoided."""
) )
def assert_json_error_contains( def assert_json_error_contains(