diff --git a/tests/components/snmp/conftest.py b/tests/components/snmp/conftest.py index 1ed2f456c8a..8626e2497b4 100644 --- a/tests/components/snmp/conftest.py +++ b/tests/components/snmp/conftest.py @@ -7,7 +7,7 @@ import pytest @pytest.fixture(autouse=True) -def patch_gethostbyname(): - """Patch gethostbyname to avoid DNS lookups in SNMP tests.""" - with patch.object(socket, "gethostbyname"): +def patch_getaddrinfo(): + """Patch getaddrinfo to avoid DNS lookups in SNMP tests.""" + with patch.object(socket, "getaddrinfo"): yield