mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use Protractor loop in Windows (#17061)
* Use Protractor loop in Windows * Add import sys
This commit is contained in:
parent
33a54043e9
commit
2feab82396
@ -2,6 +2,7 @@
|
|||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
import threading
|
import threading
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
from asyncio import coroutines
|
from asyncio import coroutines
|
||||||
from asyncio.events import AbstractEventLoop
|
from asyncio.events import AbstractEventLoop
|
||||||
from asyncio.futures import Future
|
from asyncio.futures import Future
|
||||||
@ -22,7 +23,10 @@ except AttributeError:
|
|||||||
|
|
||||||
def asyncio_run(main: Awaitable[_T], *, debug: bool = False) -> _T:
|
def asyncio_run(main: Awaitable[_T], *, debug: bool = False) -> _T:
|
||||||
"""Minimal re-implementation of asyncio.run (since 3.7)."""
|
"""Minimal re-implementation of asyncio.run (since 3.7)."""
|
||||||
loop = asyncio.new_event_loop()
|
if sys.platform == 'win32':
|
||||||
|
loop = asyncio.ProactorEventLoop()
|
||||||
|
else:
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
loop.set_debug(debug)
|
loop.set_debug(debug)
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user