mirror of
https://github.com/home-assistant/core.git
synced 2025-08-10 08:05:06 +02:00
Prevent 3rd party lib from opening sockets in zeroconf tests (#56324)
This commit is contained in:
@@ -4,8 +4,14 @@ from unittest.mock import AsyncMock, patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def zc_mock_get_source_ip(mock_get_source_ip):
|
||||||
|
"""Enable the mock_get_source_ip fixture for all zeroconf tests."""
|
||||||
|
return mock_get_source_ip
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_async_zeroconf():
|
def mock_async_zeroconf(mock_zeroconf):
|
||||||
"""Mock AsyncZeroconf."""
|
"""Mock AsyncZeroconf."""
|
||||||
with patch("homeassistant.components.zeroconf.HaAsyncZeroconf") as mock_aiozc:
|
with patch("homeassistant.components.zeroconf.HaAsyncZeroconf") as mock_aiozc:
|
||||||
zc = mock_aiozc.return_value
|
zc = mock_aiozc.return_value
|
||||||
|
Reference in New Issue
Block a user