Make test_await more robust
This commit is contained in:
parent
fc3fa708b0
commit
1207c2d03a
|
@ -607,12 +607,12 @@ import sys
|
||||||
async def main():
|
async def main():
|
||||||
res = await Once(await asyncio.sleep(0.1))
|
res = await Once(await asyncio.sleep(0.1))
|
||||||
return res
|
return res
|
||||||
|
# For an odd error similar to https://bugs.python.org/issue38563
|
||||||
# It looks like that https://bugs.python.org/issue38563 solves this problem,
|
|
||||||
# but we see still errors on Github actions...
|
|
||||||
if sys.platform == "win32" and sys.version_info >= (3, 8, 0):
|
if sys.platform == "win32" and sys.version_info >= (3, 8, 0):
|
||||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||||
loop = asyncio.get_event_loop()
|
# get_event_loop can raise an error: https://github.com/PyO3/pyo3/pull/961#issuecomment-645238579
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
assert loop.run_until_complete(main()) is None
|
assert loop.run_until_complete(main()) is None
|
||||||
loop.close()
|
loop.close()
|
||||||
"#
|
"#
|
||||||
|
|
Loading…
Reference in a new issue