Fix py38 tests (#34658)
This commit is contained in:
1 parent
40d3d64027
commit
9a4a83cb91
7 files changed
+92
-124
No files matched your search
@@ -1,6 +1,5 @@
|
||||
"""Test Google Smart Home."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from asynctest import Mock, patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import camera
|
||||
@@ -29,12 +28,7 @@ from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import BASIC_CONFIG, MockConfig
|
||||
|
||||
from tests.common import (
|
||||
mock_area_registry,
|
||||
mock_coro,
|
||||
mock_device_registry,
|
||||
mock_registry,
|
||||
)
|
||||
from tests.common import mock_area_registry, mock_device_registry, mock_registry
|
||||
|
||||
REQ_ID = "ff36a3cc-ec34-11e6-b1a0-64510650abcf"
|
||||
|
||||
@@ -262,6 +256,8 @@ async def test_query_message(hass):
|
||||
},
|
||||
}
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(events) == 4
|
||||
assert events[0].event_type == EVENT_QUERY_RECEIVED
|
||||
assert events[0].data == {
|
||||
@@ -788,9 +784,7 @@ async def test_query_disconnect(hass):
|
||||
config = MockConfig(hass=hass)
|
||||
config.async_enable_report_state()
|
||||
assert config._unsub_report_state is not None
|
||||
with patch.object(
|
||||
config, "async_disconnect_agent_user", side_effect=mock_coro
|
||||
) as mock_disconnect:
|
||||
with patch.object(config, "async_disconnect_agent_user") as mock_disconnect:
|
||||
result = await sh.async_handle_message(
|
||||
hass,
|
||||
config,
|
||||
@@ -811,7 +805,7 @@ async def test_trait_execute_adding_query_data(hass):
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.camera.async_request_stream",
|
||||
return_value=mock_coro("/api/streams/bla"),
|
||||
return_value="/api/streams/bla",
|
||||
):
|
||||
result = await sh.async_handle_message(
|
||||
hass,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""Tests for the Google Assistant traits."""
|
||||
import logging
|
||||
from unittest.mock import Mock, patch
|
||||
from unittest.mock import Mock
|
||||
|
||||
from asynctest import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import (
|
||||
@@ -45,7 +46,7 @@ from homeassistant.util import color
|
||||
|
||||
from . import BASIC_CONFIG, MockConfig
|
||||
|
||||
from tests.common import async_mock_service, mock_coro
|
||||
from tests.common import async_mock_service
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -117,7 +118,7 @@ async def test_camera_stream(hass):
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.camera.async_request_stream",
|
||||
return_value=mock_coro("/api/streams/bla"),
|
||||
return_value="/api/streams/bla",
|
||||
):
|
||||
await trt.execute(trait.COMMAND_GET_CAMERA_STREAM, BASIC_DATA, {}, {})
|
||||
|
||||
|
||||
Reference in new issue
Block a user