From: Stefano Rivera <stefano@rivera.za.net>
Date: Sun, 22 Oct 2023 11:13:11 +0200
Subject: Don't actually attempt to connect to evil.com in
 test_deprecated_no_scheme

Forwarded: https://github.com/urllib3/urllib3/pull/3163
---
 test/test_poolmanager.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/test_poolmanager.py b/test/test_poolmanager.py
index 821e218..ae37cfa 100644
--- a/test/test_poolmanager.py
+++ b/test/test_poolmanager.py
@@ -259,11 +259,14 @@ class TestPoolManager:
         assert pool is other_pool
         assert all(isinstance(key, PoolKey) for key in p.pools.keys())
 
-    def test_deprecated_no_scheme(self) -> None:
+    @patch("urllib3.poolmanager.PoolManager.connection_from_host")
+    def test_deprecated_no_scheme(self, connection_from_host: mock.MagicMock) -> None:
+        connection_from_host.side_effect = ConnectionError("Not attempting connection")
         p = PoolManager()
 
         with pytest.warns(DeprecationWarning) as records:
-            p.request(method="GET", url="evil.com://good.com")
+            with pytest.raises(ConnectionError):
+                p.request(method="GET", url="evil.com://good.com")
 
         msg = (
             "URLs without a scheme (ie 'https://') are deprecated and will raise an error "
