From: Stefano Rivera <stefanor@debian.org>
Date: Sat, 21 Oct 2023 19:32:31 +0200
Subject: Tests: skip the requires_network() when heavily firewalled

requires_network() attempts to detect Internet access by probing
non-local IPs. A restricted environment may appear to have a routes to
the Internet, but block all outbound traffic.

Treat that as not having network.

Forwarded: https://github.com/urllib3/urllib3/pull/3162
---
 test/__init__.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/__init__.py b/test/__init__.py
index a1629e7..7f75ad2 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -201,6 +201,9 @@ def requires_network() -> typing.Callable[[_TestFuncT], _TestFuncT]:
             return True
         except socket.timeout:
             return True
+        except ConnectionRefusedError:
+            # A firewall is explicitly blocking outbound traffic
+            return False
         except OSError as e:
             if _is_unreachable_err(e):
                 return False
