import pytest import ifaddr def test_get_adapters(): """Test 'get_adapters' against 'lo' interface.""" lo_ips = [ n.ip if not isinstance(n.ip, tuple) else n.ip[0] for a in ifaddr.get_adapters() if a.name == "lo" for n in a.ips ] assert "127.0.0.1" in lo_ips assert "::1" in lo_ips