mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
change: do not raise error if failed to get client/server address info
This commit is contained in:
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
- feat: integrate [locust](https://locust.io/) v1.0
|
- feat: integrate [locust](https://locust.io/) v1.0
|
||||||
|
|
||||||
|
**Fixed**
|
||||||
|
|
||||||
|
- change: do not raise error if failed to get client/server address info
|
||||||
|
|
||||||
## 3.0.13 (2020-06-17)
|
## 3.0.13 (2020-06-17)
|
||||||
|
|
||||||
**Added**
|
**Added**
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ from requests.exceptions import (
|
|||||||
RequestException,
|
RequestException,
|
||||||
)
|
)
|
||||||
|
|
||||||
from httprunner.exceptions import NetworkFailure
|
|
||||||
from httprunner.models import RequestData, ResponseData
|
from httprunner.models import RequestData, ResponseData
|
||||||
from httprunner.models import SessionData, ReqRespData
|
from httprunner.models import SessionData, ReqRespData
|
||||||
from httprunner.utils import lower_dict_keys, omit_long_data
|
from httprunner.utils import lower_dict_keys, omit_long_data
|
||||||
@@ -186,7 +185,7 @@ class HttpSession(requests.Session):
|
|||||||
self.data.address.client_port = client_port
|
self.data.address.client_port = client_port
|
||||||
logger.debug(f"client IP: {client_ip}, Port: {client_port}")
|
logger.debug(f"client IP: {client_ip}, Port: {client_port}")
|
||||||
except AttributeError as ex:
|
except AttributeError as ex:
|
||||||
raise NetworkFailure(f"failed to get client address info: {ex}")
|
logger.warning(f"failed to get client address info: {ex}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
server_ip, server_port = response.raw.connection.sock.getpeername()
|
server_ip, server_port = response.raw.connection.sock.getpeername()
|
||||||
@@ -194,7 +193,7 @@ class HttpSession(requests.Session):
|
|||||||
self.data.address.server_port = server_port
|
self.data.address.server_port = server_port
|
||||||
logger.debug(f"server IP: {server_ip}, Port: {server_port}")
|
logger.debug(f"server IP: {server_ip}, Port: {server_port}")
|
||||||
except AttributeError as ex:
|
except AttributeError as ex:
|
||||||
raise NetworkFailure(f"failed to get server address info: {ex}")
|
logger.warning(f"failed to get server address info: {ex}")
|
||||||
|
|
||||||
# get length of the response content
|
# get length of the response content
|
||||||
content_size = int(dict(response.headers).get("content-length") or 0)
|
content_size = int(dict(response.headers).get("content-length") or 0)
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ class TeardownHooksFailure(MyBaseFailure):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NetworkFailure(MyBaseFailure):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
""" error type exceptions
|
""" error type exceptions
|
||||||
these exceptions will mark test as error
|
these exceptions will mark test as error
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user