From a7e203610c83b159ff971125c51877bbd5181bc8 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sat, 21 Dec 2019 17:08:46 +0800 Subject: [PATCH 1/9] fix: init sentry_sdk before main --- httprunner/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/httprunner/__main__.py b/httprunner/__main__.py index 59d39cb5..ca8cc147 100644 --- a/httprunner/__main__.py +++ b/httprunner/__main__.py @@ -2,10 +2,9 @@ import sys import sentry_sdk -from httprunner.cli import main - sentry_sdk.init("https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849") if __name__ == "__main__": + from httprunner.cli import main sys.exit(main()) From 5d62d0a3c7696b10278e8f834147b23f4caea940 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sat, 21 Dec 2019 17:21:00 +0800 Subject: [PATCH 2/9] fix: ensure initializing sentry_sdk on startup --- docs/CHANGELOG.md | 8 ++++++++ httprunner/__init__.py | 5 ++++- httprunner/__main__.py | 6 +----- pyproject.toml | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2bfc6d4e..647be79e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 2.4.6 (2019-12-21) + +**Fixed** + +- fix: ensure initializing sentry_sdk on startup + +**Fixed** + ## 2.4.5 (2019-12-20) **Added** diff --git a/httprunner/__init__.py b/httprunner/__init__.py index 798f1866..e345eca5 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -1,4 +1,7 @@ -__version__ = "2.4.5" +__version__ = "2.4.6" __description__ = "One-stop solution for HTTP(S) testing." __all__ = ["__version__", "__description__"] + +import sentry_sdk +sentry_sdk.init("https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849") diff --git a/httprunner/__main__.py b/httprunner/__main__.py index ca8cc147..70236a86 100644 --- a/httprunner/__main__.py +++ b/httprunner/__main__.py @@ -1,10 +1,6 @@ import sys - -import sentry_sdk - -sentry_sdk.init("https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849") +from httprunner.cli import main if __name__ == "__main__": - from httprunner.cli import main sys.exit(main()) diff --git a/pyproject.toml b/pyproject.toml index cdc3defa..4b83ec9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "httprunner" -version = "2.4.5" +version = "2.4.6" description = "One-stop solution for HTTP(S) testing." license = "Apache-2.0" readme = "README.md" From 8de77c6ab85b2babcb1d72534f87df443edec7f0 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 16:40:15 +0800 Subject: [PATCH 3/9] change: remove default issue title --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/bug_report_zh.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/feature_request_zh.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c14f3efa..d5dd03b6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Create a report to help us improve -title: BUG +title: '' labels: Pending assignees: debugtalk --- diff --git a/.github/ISSUE_TEMPLATE/bug_report_zh.md b/.github/ISSUE_TEMPLATE/bug_report_zh.md index 7879cfc0..3cb953f2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_zh.md +++ b/.github/ISSUE_TEMPLATE/bug_report_zh.md @@ -1,7 +1,7 @@ --- name: Bug 反馈(中文) about: 提交 bug 反馈 -title: BUG +title: '' labels: Pending assignees: debugtalk --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 6d66475a..5adc1cfa 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project -title: FEATURE +title: '' labels: Pending assignees: debugtalk --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_zh.md b/.github/ISSUE_TEMPLATE/feature_request_zh.md index 882c553d..32f3bc5f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_zh.md +++ b/.github/ISSUE_TEMPLATE/feature_request_zh.md @@ -1,7 +1,7 @@ --- name: 需求反馈 about: 期望新增或改进实现的需求 -title: FEATURE +title: '' labels: Pending assignees: debugtalk --- From 2a9457347a8c31e4ed85629505080ede8cbb53b9 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 17:02:35 +0800 Subject: [PATCH 4/9] docs: add sentry sponsor logo --- README.md | 6 ++++++ docs/assets/sentry-logo-black.svg | 1 + docs/sponsors.md | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 docs/assets/sentry-logo-black.svg diff --git a/README.md b/README.md index 4bdbb75c..40a85bde 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,12 @@ Thank you to all our sponsors! ✨🍰✨ ([become a sponsor](docs/sponsors.md)) 霍格沃兹测试学院是 HttpRunner 的首家金牌赞助商。 +### 开源服务赞助商(Open Source Sponsor) + +[Sentry](https://sentry.io/_/open-source/) + +HttpRunner is in Sentry Sponsored plan. + ## How to Contribute 1. Check for [open issues](https://github.com/httprunner/httprunner/issues) or [open a fresh issue](https://github.com/httprunner/httprunner/issues/new/choose) to start a discussion around a feature idea or a bug. diff --git a/docs/assets/sentry-logo-black.svg b/docs/assets/sentry-logo-black.svg new file mode 100644 index 00000000..59b79bc5 --- /dev/null +++ b/docs/assets/sentry-logo-black.svg @@ -0,0 +1 @@ +sentry-logo-black \ No newline at end of file diff --git a/docs/sponsors.md b/docs/sponsors.md index 40be9967..9a379cf4 100644 --- a/docs/sponsors.md +++ b/docs/sponsors.md @@ -10,6 +10,12 @@ 霍格沃兹测试学院是 HttpRunner 的首家金牌赞助商。 +### 开源服务赞助商(Open Source Sponsor) + +[Sentry](https://sentry.io/_/open-source/) + +HttpRunner is in Sentry Sponsored plan. + ## 成为赞助商 如果你所在的公司或个人也想对 HttpRunner 进行赞助,可参考如下方案,具体可联系[项目作者](mailto:mail@debugtalk.com)。 From d2edb376faa29187ded5fc6e8f9151ce44edeac3 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 17:08:26 +0800 Subject: [PATCH 5/9] chang: adjust sentry logo size --- README.md | 2 +- docs/sponsors.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40a85bde..0cfe8ca6 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Thank you to all our sponsors! ✨🍰✨ ([become a sponsor](docs/sponsors.md)) ### 开源服务赞助商(Open Source Sponsor) -[Sentry](https://sentry.io/_/open-source/) +[Sentry](https://sentry.io/_/open-source/) HttpRunner is in Sentry Sponsored plan. diff --git a/docs/sponsors.md b/docs/sponsors.md index 9a379cf4..12a220b0 100644 --- a/docs/sponsors.md +++ b/docs/sponsors.md @@ -12,7 +12,7 @@ ### 开源服务赞助商(Open Source Sponsor) -[Sentry](https://sentry.io/_/open-source/) +[Sentry](https://sentry.io/_/open-source/) HttpRunner is in Sentry Sponsored plan. From babd2e94a72dd9bde371a29087a2905fca1b562c Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 17:19:21 +0800 Subject: [PATCH 6/9] change: update email --- docs/sponsors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sponsors.md b/docs/sponsors.md index 12a220b0..fdc764ad 100644 --- a/docs/sponsors.md +++ b/docs/sponsors.md @@ -18,7 +18,7 @@ HttpRunner is in Sentry Sponsored plan. ## 成为赞助商 -如果你所在的公司或个人也想对 HttpRunner 进行赞助,可参考如下方案,具体可联系[项目作者](mailto:mail@debugtalk.com)。 +如果你所在的公司或个人也想对 HttpRunner 进行赞助,可参考如下方案,具体可联系[项目作者](mailto:debugtalk@gmail.com)。 | 等级 | 金牌赞助商
(Gold Sponsor) | 银牌赞助商
(Silver Sponsor)| 个人赞赏 | |:---:|:---:|:---:|:---:| From d41ca23cea3d33173d5d2863e78d3c9316adb031 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 17:28:37 +0800 Subject: [PATCH 7/9] feat: report tests start event and running exception to sentry --- docs/CHANGELOG.md | 6 +++++- httprunner/api.py | 3 +++ httprunner/cli.py | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 647be79e..08363413 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Release History -## 2.4.6 (2019-12-21) +## 2.4.6 (2019-12-23) + +**Added** + +- feat: report tests start event and running exception to sentry **Fixed** diff --git a/httprunner/api.py b/httprunner/api.py index 18ec9389..7e017213 100644 --- a/httprunner/api.py +++ b/httprunner/api.py @@ -1,6 +1,8 @@ import os import unittest +from sentry_sdk import capture_message + from httprunner import (__version__, exceptions, loader, logger, parser, report, runner, utils) @@ -183,6 +185,7 @@ class HttpRunner(object): def run_tests(self, tests_mapping): """ run testcase/testsuite data """ + capture_message("start to run tests") project_mapping = tests_mapping.get("project_mapping", {}) self.project_working_directory = project_mapping.get("PWD", os.getcwd()) diff --git a/httprunner/cli.py b/httprunner/cli.py index a2356591..dcabb184 100644 --- a/httprunner/cli.py +++ b/httprunner/cli.py @@ -1,7 +1,7 @@ import argparse import os import sys - +from sentry_sdk import capture_exception from httprunner import __description__, __version__ from httprunner.api import HttpRunner from httprunner.compat import is_py2 @@ -101,8 +101,9 @@ def main(): report_file=args.report_file ) err_code |= (0 if summary and summary["success"] else 1) - except Exception: + except Exception as ex: color_print("!!!!!!!!!! exception stage: {} !!!!!!!!!!".format(runner.exception_stage), "YELLOW") + capture_exception(ex) raise return err_code From 74af735e1e80d24358ac621609173781240b6a9b Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 18:44:05 +0800 Subject: [PATCH 8/9] feat: add version tag for sentry --- httprunner/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/httprunner/__init__.py b/httprunner/__init__.py index e345eca5..04424948 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -4,4 +4,8 @@ __description__ = "One-stop solution for HTTP(S) testing." __all__ = ["__version__", "__description__"] import sentry_sdk + sentry_sdk.init("https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849") + +with sentry_sdk.configure_scope() as scope: + scope.set_tag("version", __version__) From db447bad6c766e2559cf68ea76dbaf02441fa216 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 23 Dec 2019 22:02:02 +0800 Subject: [PATCH 9/9] change: report release to sentry --- httprunner/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/httprunner/__init__.py b/httprunner/__init__.py index 04424948..5beb3a6c 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -5,7 +5,7 @@ __all__ = ["__version__", "__description__"] import sentry_sdk -sentry_sdk.init("https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849") - -with sentry_sdk.configure_scope() as scope: - scope.set_tag("version", __version__) +sentry_sdk.init( + dsn="https://cc6dd86fbe9f4e7fbd95248cfcff114d@sentry.io/1862849", + release="httprunner@{}".format(__version__) +)