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

Use the shared zeroconf instance when attempting to create another Zeroconf instance (#38744)

This commit is contained in:
J. Nick Koston
2020-08-12 09:08:33 -05:00
committed by GitHub
parent 34cb12d3c9
commit 444df4a7d2
8 changed files with 187 additions and 17 deletions

View File

@@ -36,6 +36,39 @@ async def test_extract_frame_integration(caplog):
assert found_frame == correct_frame
async def test_extract_frame_integration_with_excluded_intergration(caplog):
"""Test extracting the current frame from integration context."""
correct_frame = Mock(
filename="/home/dev/homeassistant/components/mdns/light.py",
lineno="23",
line="self.light.is_on",
)
with patch(
"homeassistant.helpers.frame.extract_stack",
return_value=[
Mock(
filename="/home/dev/homeassistant/core.py",
lineno="23",
line="do_something()",
),
correct_frame,
Mock(
filename="/home/dev/homeassistant/components/zeroconf/usage.py",
lineno="23",
line="self.light.is_on",
),
Mock(filename="/home/dev/mdns/lights.py", lineno="2", line="something()",),
],
):
found_frame, integration, path = frame.get_integration_frame(
exclude_integrations={"zeroconf"}
)
assert integration == "mdns"
assert path == "homeassistant/components/"
assert found_frame == correct_frame
async def test_extract_frame_no_integration(caplog):
"""Test extracting the current frame without integration context."""
with patch(