We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 509ff6a commit 3b0e320Copy full SHA for 3b0e320
1 file changed
tests/devices/test_device_manager.py
@@ -1,7 +1,7 @@
1
"""Tests for the DeviceManager class."""
2
3
from collections.abc import Generator
4
-from unittest.mock import patch
+from unittest.mock import patch, Mock, AsyncMock
5
6
import pytest
7
@@ -16,10 +16,12 @@
16
17
18
@pytest.fixture(autouse=True)
19
-def setup_mqtt_session() -> Generator[None, None, None]:
+def setup_mqtt_session() -> Generator[Mock, None, None]:
20
"""Fixture to set up the MQTT session for the tests."""
21
- with patch("roborock.devices.device_manager.create_mqtt_session"):
22
- yield
+ with patch("roborock.devices.device_manager.create_mqtt_session") as mock_create_session:
+ mock_unsub = Mock()
23
+ mock_create_session.return_value.subscribe.return_value = mock_unsub
24
+ yield mock_create_session
25
26
27
async def home_home_data_no_devices() -> HomeData:
0 commit comments