Refactor frame.get_integration_frame (#101322)

This commit is contained in:
Erik Montnemery
2023-10-03 19:21:27 +02:00
committed by GitHub
parent 956098ae3a
commit ab2de18f8f
5 changed files with 163 additions and 60 deletions

View File

@@ -1515,33 +1515,6 @@ async def recorder_mock(
return await async_setup_recorder_instance(hass, recorder_config)
@pytest.fixture
def mock_integration_frame() -> Generator[Mock, None, None]:
"""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
@pytest.fixture(name="enable_bluetooth")
async def mock_enable_bluetooth(
hass: HomeAssistant,