Skip to content

Commit 2afe874

Browse files
committed
Ignore asyncio.set_event_loop_policy() deprecation warning in test
Ignore `asyncio.set_event_loop_policy()` deprecation warning when called directly in test. I have scoped the ignore to the test call rather than doing that globally in `pytest.ini`, so that it will be caught if introduced elsewhere in the code.
1 parent daba375 commit 2afe874

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_async_py3.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,8 @@ async def f():
17331733
pass
17341734
finally:
17351735
loop.close()
1736-
asyncio.set_event_loop_policy(None)
1736+
with warnings.catch_warnings():
1737+
warnings.simplefilter('ignore', DeprecationWarning)
1738+
asyncio.set_event_loop_policy(None)
17371739

17381740
assert buffer == [1, 2, 'MyException']

0 commit comments

Comments
 (0)