1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Do not use AsyncTrackStates (#47255)

This commit is contained in:
Paulus Schoutsen
2021-03-11 23:18:09 -08:00
committed by GitHub
parent 2a22c54fcb
commit ff94e920e4
6 changed files with 73 additions and 43 deletions

31
tests/helpers/conftest.py Normal file
View File

@@ -0,0 +1,31 @@
"""Fixtures for helpers."""
from unittest.mock import Mock, patch
import pytest
@pytest.fixture
def mock_integration_frame():
"""Mock as if we're calling code from inside an integration."""
correct_frame = Mock(
filename="/home/paulus/homeassistant/components/hue/light.py",
lineno="23",
line="self.light.is_on",
)
with patch(
"homeassistant.helpers.frame.extract_stack",
return_value=[
Mock(
filename="/home/paulus/homeassistant/core.py",
lineno="23",
line="do_something()",
),
correct_frame,
Mock(
filename="/home/paulus/aiohue/lights.py",
lineno="2",
line="something()",
),
],
):
yield correct_frame