mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Allow testing against uvloop (#6468)
This commit is contained in:
parent
470702261a
commit
44d4987536
@ -56,7 +56,6 @@ def get_test_home_assistant():
|
|||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
loop._thread_ident = threading.get_ident()
|
loop._thread_ident = threading.get_ident()
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
loop.close()
|
|
||||||
stop_event.set()
|
stop_event.set()
|
||||||
|
|
||||||
orig_start = hass.start
|
orig_start = hass.start
|
||||||
@ -73,6 +72,7 @@ def get_test_home_assistant():
|
|||||||
"""Stop hass."""
|
"""Stop hass."""
|
||||||
orig_stop()
|
orig_stop()
|
||||||
stop_event.wait()
|
stop_event.wait()
|
||||||
|
loop.close()
|
||||||
|
|
||||||
hass.start = start_hass
|
hass.start = start_hass
|
||||||
hass.stop = stop_hass
|
hass.stop = stop_hass
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""Setup some common test helper things."""
|
"""Setup some common test helper things."""
|
||||||
|
import asyncio
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -13,6 +15,10 @@ from homeassistant.components import mqtt
|
|||||||
from .common import async_test_home_assistant, mock_coro
|
from .common import async_test_home_assistant, mock_coro
|
||||||
from .test_util.aiohttp import mock_aiohttp_client
|
from .test_util.aiohttp import mock_aiohttp_client
|
||||||
|
|
||||||
|
if os.environ.get('UVLOOP') == '1':
|
||||||
|
import uvloop
|
||||||
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
|
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user