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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user