diff --git a/tests/shared.py b/tests/shared.py index 48e54e19d8..15c8d428a6 100644 --- a/tests/shared.py +++ b/tests/shared.py @@ -336,12 +336,12 @@ def no_internet_connection(): conn = socket.create_connection((host, 80), 2) conn.close() return False - except socket.gaierror: + except (socket.gaierror, TimeoutError): return True def assert_domain_equal(a, b): - "Check that two domains are equal, ignoring empty domains" + """Check that two domains are equal, ignoring empty domains""" a_dict = {k: v for k, v in a.items() if v != []} b_dict = {k: v for k, v in b.items() if v != []} assert a_dict == b_dict