mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Prevent 3rd party lib from opening sockets in ping tests (#56329)
This commit is contained in:
parent
bce4c5eb11
commit
a793fd4134
@ -2,12 +2,21 @@
|
|||||||
from os import path
|
from os import path
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from homeassistant import config as hass_config, setup
|
from homeassistant import config as hass_config, setup
|
||||||
from homeassistant.components.ping import DOMAIN
|
from homeassistant.components.ping import DOMAIN
|
||||||
from homeassistant.const import SERVICE_RELOAD
|
from homeassistant.const import SERVICE_RELOAD
|
||||||
|
|
||||||
|
|
||||||
async def test_reload(hass):
|
@pytest.fixture
|
||||||
|
def mock_ping():
|
||||||
|
"""Mock icmplib.ping."""
|
||||||
|
with patch("homeassistant.components.ping.icmp_ping"):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
async def test_reload(hass, mock_ping):
|
||||||
"""Verify we can reload trend sensors."""
|
"""Verify we can reload trend sensors."""
|
||||||
|
|
||||||
await setup.async_setup_component(
|
await setup.async_setup_component(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user