fix #819: maximum recursion error in locusts, caused by sentry sdk

This commit is contained in:
debugtalk
2020-01-02 21:30:34 +08:00
parent 1b08e7904a
commit d0126eef9c
6 changed files with 23 additions and 16 deletions

View File

@@ -5,6 +5,7 @@
**Fixed**
- fix #826: Windows does not support file name include ":"
- fix #819: maximum recursion error in locusts
## 2.5.1 (2020-01-02)

View File

@@ -2,15 +2,3 @@ __version__ = "2.5.2"
__description__ = "One-stop solution for HTTP(S) testing."
__all__ = ["__version__", "__description__"]
import uuid
import sentry_sdk
sentry_sdk.init(
dsn="https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849",
release="httprunner@{}".format(__version__)
)
with sentry_sdk.configure_scope() as scope:
scope.set_user({"id": uuid.getnode()})

View File

@@ -2,7 +2,7 @@ import argparse
import os
import sys
from sentry_sdk import capture_exception
import sentry_sdk
from httprunner import __description__, __version__, exceptions
from httprunner.api import HttpRunner
@@ -11,7 +11,9 @@ from httprunner.loader import load_cases
from httprunner.logger import color_print, log_error
from httprunner.report import gen_html_report
from httprunner.utils import (create_scaffold, get_python2_retire_msg,
prettify_json_file)
prettify_json_file, init_sentry_sdk)
init_sentry_sdk()
def main():
@@ -115,7 +117,7 @@ def main():
except Exception as ex:
color_print("!!!!!!!!!! exception stage: {} !!!!!!!!!!".format(runner.exception_stage), "YELLOW")
color_print(str(ex), "RED")
capture_exception(ex)
sentry_sdk.capture_exception(ex)
err_code = 1
sys.exit(err_code)

View File

View File

@@ -19,6 +19,9 @@ import os
import sys
from httprunner import logger
from httprunner.utils import init_sentry_sdk
init_sentry_sdk()
def parse_locustfile(file_path):

View File

@@ -7,15 +7,28 @@ import itertools
import json
import os.path
import re
import uuid
from datetime import datetime
from httprunner import exceptions, logger
import sentry_sdk
from httprunner import exceptions, logger, __version__
from httprunner.compat import basestring, bytes, is_py2
from httprunner.exceptions import ParamsError
absolute_http_url_regexp = re.compile(r"^https?://", re.I)
def init_sentry_sdk():
sentry_sdk.init(
dsn="https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849",
release="httprunner@{}".format(__version__)
)
with sentry_sdk.configure_scope() as scope:
scope.set_user({"id": uuid.getnode()})
def set_os_environ(variables_mapping):
""" set variables mapping to os.environ
"""