Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def send(self, request, **kwargs): # type: ignore
allow_redirects=False,
**kwargs)

except urllib3.exceptions.NewConnectionError as err:
except (urllib3.exceptions.NewConnectionError, urllib3.exceptions.ConnectTimeoutError) as err:
error = ServiceRequestError(err, error=err)
except requests.exceptions.ReadTimeout as err:
error = ServiceResponseError(err, error=err)
Expand Down
13 changes: 12 additions & 1 deletion sdk/core/azure-core/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
RequestsTransport
)

from azure.core.configuration import Configuration
from azure.core.exceptions import ServiceRequestError


def test_sans_io_exception():
Expand Down Expand Up @@ -107,6 +107,17 @@ def test_basic_requests(self):
assert pipeline._transport.session is None
assert response.http_response.status_code == 200

def test_requests_socket_timeout(self):
conf = Configuration()
request = HttpRequest("GET", "https://bing.com")
policies = [
UserAgentPolicy("myusergant"),
RedirectPolicy()
]
with pytest.raises(ServiceRequestError):
with Pipeline(RequestsTransport(), policies=policies) as pipeline:
response = pipeline.run(request, connection_timeout=0.000001)

def test_basic_requests_separate_session(self):

session = requests.Session()
Expand Down