Skip to content

Commit

Permalink
test: allow to use assert_num_queries without the gql_client fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
bellini666 committed Jul 13, 2024
1 parent cb9f63a commit 3aa993a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ def assert_num_queries(n: int, *, using=DEFAULT_DB_ALIAS):
# FIXME: Async will not have access to the correct number of queries without
# execing CaptureQueriesContext.(__enter__|__exit__) wrapped in sync_to_async
# How can we fix this?
if _client.get().is_async and executed == 0:
return
with contextlib.suppress(LookupError):
if _client.get().is_async and executed == 0:
return

assert (
executed == n
Expand Down

0 comments on commit 3aa993a

Please sign in to comment.