Skip to content

Commit

Permalink
_assert_num_queries: keep num arg name
Browse files Browse the repository at this point in the history
It might be used already by others, so avoid problems due to renaming
it.

Ref: #661
  • Loading branch information
blueyed committed Oct 30, 2018
1 parent accae0d commit 39d3e5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def _live_server_helper(request):


@contextmanager
def _assert_num_queries(config, num_expected, exact=True, connection=None):
def _assert_num_queries(config, num, exact=True, connection=None):
from django.test.utils import CaptureQueriesContext

if connection is None:
Expand All @@ -418,12 +418,12 @@ def _assert_num_queries(config, num_expected, exact=True, connection=None):
yield context
num_performed = len(context)
if exact:
failed = num_expected != num_performed
failed = num != num_performed
else:
failed = num_performed > num_expected
failed = num_performed > num
if failed:
msg = "Expected to perform {} queries {}{}".format(
num_expected,
num,
"" if exact else "or less ",
"but {} done".format(
num_performed == 1 and "1 was" or "%d were" % (num_performed,)
Expand Down

0 comments on commit 39d3e5c

Please sign in to comment.