Fix race configuring zeroconf (#138425)
This commit is contained in:
@@ -1180,15 +1180,31 @@ async def mqtt_mock_entry(
|
||||
@pytest.fixture(autouse=True, scope="session")
|
||||
def mock_network() -> Generator[None]:
|
||||
"""Mock network."""
|
||||
with patch(
|
||||
"homeassistant.components.network.util.ifaddr.get_adapters",
|
||||
return_value=[
|
||||
Mock(
|
||||
nice_name="eth0",
|
||||
ips=[Mock(is_IPv6=False, ip="10.10.10.10", network_prefix=24)],
|
||||
index=0,
|
||||
)
|
||||
],
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.network.util.ifaddr.get_adapters",
|
||||
return_value=[
|
||||
Mock(
|
||||
nice_name="eth0",
|
||||
ips=[Mock(is_IPv6=False, ip="10.10.10.10", network_prefix=24)],
|
||||
index=0,
|
||||
)
|
||||
],
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.network.async_get_loaded_adapters",
|
||||
return_value=[
|
||||
{
|
||||
"auto": True,
|
||||
"default": True,
|
||||
"enabled": True,
|
||||
"index": 0,
|
||||
"ipv4": [{"address": "10.10.10.10", "network_prefix": 24}],
|
||||
"ipv6": [],
|
||||
"name": "eth0",
|
||||
}
|
||||
],
|
||||
),
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
Reference in New Issue
Block a user