Skip to content
Snippets Groups Projects
Unverified Commit 502dba0c authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by GitHub
Browse files

GH-89369: test_contextlib_async finalizes event loop after each test (GH-93074)



Use asyncio.run().
(cherry picked from commit d2ef66a1)

Co-authored-by: default avatarKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
parent db2b1e18
Branches
Tags
No related merge requests found
......@@ -14,15 +14,12 @@ def _async_test(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
coro = func(*args, **kwargs)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
return loop.run_until_complete(coro)
finally:
loop.close()
asyncio.set_event_loop_policy(None)
asyncio.run(coro)
return wrapper
def tearDownModule():
asyncio.set_event_loop_policy(None)
class TestAbstractAsyncContextManager(unittest.TestCase):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment