Prevent 3rd party lib from opening sockets in ping tests (#56329)

This commit is contained in:
Erik Montnemery 2021-09-17 11:41:19 +02:00 committed by GitHub
parent bce4c5eb11
commit a793fd4134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,12 +2,21 @@
from os import path
from unittest.mock import patch
import pytest
from homeassistant import config as hass_config, setup
from homeassistant.components.ping import DOMAIN
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."""
await setup.async_setup_component(