Skip to content

Commit b30a66c

Browse files
committed
Add timeouts to slow proxy tests to prevent CI hangs
Added 10-second timeouts to 5 proxy tests that make real HTTPS requests to example.com: - test_https_via_proxy_connect - test_https_via_proxy_with_auth - test_no_proxy_parameter - test_empty_proxy - test_none_proxy Without timeouts, these tests could hang indefinitely in CI, causing the test_proxy.py suite to take 5-10 minutes. With timeouts, all 19 tests now complete in ~2 minutes while still validating real HTTPS proxy functionality.
1 parent 03c15d9 commit b30a66c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_proxy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_http_via_proxy(self):
2222
def test_https_via_proxy_connect(self):
2323
"""Test HTTPS request via proxy using CONNECT method"""
2424
with MockProxyServer() as proxy:
25-
response = httpmorph.get("https://example.com", proxy=proxy.url)
25+
response = httpmorph.get("https://example.com", proxy=proxy.url, timeout=10)
2626
assert response.status_code in [200, 301, 302]
2727

2828
def test_proxy_parameter_string(self):
@@ -81,7 +81,7 @@ def test_https_via_proxy_with_auth(self):
8181
"""Test HTTPS via proxy with authentication"""
8282
with MockProxyServer(username="testuser", password="testpass") as proxy:
8383
response = httpmorph.get(
84-
"https://example.com", proxy=proxy.url, proxy_auth=("testuser", "testpass")
84+
"https://example.com", proxy=proxy.url, proxy_auth=("testuser", "testpass"), timeout=10
8585
)
8686
assert response.status_code in [200, 301, 302]
8787

@@ -126,17 +126,17 @@ class TestProxyEdgeCases:
126126

127127
def test_no_proxy_parameter(self):
128128
"""Test request without proxy (normal direct connection)"""
129-
response = httpmorph.get("https://example.com")
129+
response = httpmorph.get("https://example.com", timeout=10)
130130
assert response.status_code in [200, 301, 302]
131131

132132
def test_empty_proxy(self):
133133
"""Test with empty proxy parameter"""
134-
response = httpmorph.get("https://example.com", proxy="")
134+
response = httpmorph.get("https://example.com", proxy="", timeout=10)
135135
assert response.status_code in [200, 301, 302]
136136

137137
def test_none_proxy(self):
138138
"""Test with None proxy parameter"""
139-
response = httpmorph.get("https://example.com", proxy=None)
139+
response = httpmorph.get("https://example.com", proxy=None, timeout=10)
140140
assert response.status_code in [200, 301, 302]
141141

142142
def test_proxy_with_session(self):

0 commit comments

Comments
 (0)