Skip to content

Commit c409614

Browse files
committed
Ignore expected warnings when running tests
1 parent 0f81d95 commit c409614

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

tests/execution/test_lists.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ async def contains_values():
377377
)
378378

379379
@mark.asyncio
380-
@mark.filterwarnings("ignore::RuntimeWarning")
380+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
381381
async def contains_null():
382382
await check_async(
383383
type_,
@@ -396,7 +396,7 @@ async def contains_null():
396396
)
397397

398398
@mark.asyncio
399-
@mark.filterwarnings("ignore::RuntimeWarning")
399+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
400400
async def contains_async_error():
401401
await check_async(
402402
type_,
@@ -520,7 +520,7 @@ async def contains_values():
520520
)
521521

522522
@mark.asyncio
523-
@mark.filterwarnings("ignore::RuntimeWarning")
523+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
524524
async def contains_null():
525525
await check_async(
526526
type_,
@@ -539,7 +539,7 @@ async def contains_null():
539539
)
540540

541541
@mark.asyncio
542-
@mark.filterwarnings("ignore::RuntimeWarning")
542+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
543543
async def contains_async_error():
544544
await check_async(
545545
type_,

tests/execution/test_sync.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from gc import collect
12
from inspect import isawaitable
23
from typing import Awaitable, cast
34

@@ -108,6 +109,7 @@ def throws_if_encountering_async_operation_with_check_sync():
108109
msg = str(exc_info.value)
109110
assert msg == "GraphQL execution failed to complete synchronously."
110111

112+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
111113
def throws_if_encountering_async_operation_without_check_sync():
112114
doc = "query Example { syncField, asyncField }"
113115
result = graphql_sync(schema, doc, "rootValue")
@@ -122,3 +124,6 @@ def throws_if_encountering_async_operation_without_check_sync():
122124
}
123125
],
124126
)
127+
# garbage collect coroutine in order to swallow warning
128+
del result
129+
collect()

tests/pyutils/test_is_awaitable.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,15 @@ async def some_coroutine():
6666
assert not isawaitable(some_coroutine)
6767
assert not is_awaitable(some_coroutine)
6868

69-
@mark.filterwarnings("ignore::RuntimeWarning")
69+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
7070
def recognizes_a_coroutine_object():
7171
async def some_coroutine():
7272
return False # pragma: no cover
7373

7474
assert isawaitable(some_coroutine())
7575
assert is_awaitable(some_coroutine())
7676

77-
@mark.filterwarnings("ignore::RuntimeWarning")
78-
@mark.filterwarnings("ignore::DeprecationWarning")
77+
@mark.filterwarnings("ignore::Warning") # Deprecation and Runtime
7978
def recognizes_an_old_style_coroutine():
8079
@asyncio.coroutine
8180
def some_old_style_coroutine():
@@ -84,7 +83,7 @@ def some_old_style_coroutine():
8483
assert is_awaitable(some_old_style_coroutine())
8584
assert is_awaitable(some_old_style_coroutine())
8685

87-
@mark.filterwarnings("ignore::RuntimeWarning")
86+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
8887
def recognizes_a_future_object():
8988
async def some_coroutine():
9089
return False # pragma: no cover
@@ -94,7 +93,7 @@ async def some_coroutine():
9493
assert is_awaitable(some_future)
9594
assert is_awaitable(some_future)
9695

97-
@mark.filterwarnings("ignore::RuntimeWarning")
96+
@mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning")
9897
def declines_an_async_generator():
9998
async def some_async_generator():
10099
yield True # pragma: no cover

0 commit comments

Comments
 (0)