Skip to content

Commit 1207c2d

Browse files
committed
Make test_await more robust
1 parent fc3fa70 commit 1207c2d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_dunder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,12 @@ import sys
607607
async def main():
608608
res = await Once(await asyncio.sleep(0.1))
609609
return res
610-
611-
# It looks like that https://bugs.python.org/issue38563 solves this problem,
612-
# but we see still errors on Github actions...
610+
# For an odd error similar to https://bugs.python.org/issue38563
613611
if sys.platform == "win32" and sys.version_info >= (3, 8, 0):
614612
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
615-
loop = asyncio.get_event_loop()
613+
# get_event_loop can raise an error: https://github.com/PyO3/pyo3/pull/961#issuecomment-645238579
614+
loop = asyncio.new_event_loop()
615+
asyncio.set_event_loop(loop)
616616
assert loop.run_until_complete(main()) is None
617617
loop.close()
618618
"#

0 commit comments

Comments
 (0)