From 0a7f11123656ca02a91c66d5bad533656b406bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Sun, 30 Jul 2023 19:03:30 +0900 Subject: [PATCH] update launch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- .vscode/launch.json | 7 +++++-- test/python/test_serialize.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index dbb6544..a22fa13 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "request": "launch", "program": "tools/build.py", "console": "integratedTerminal", - "justMyCode": false + "justMyCode": true }, { "name": "Python: Test OpenAPI Serialize", @@ -16,7 +16,10 @@ "program": "test/python/test_serialize.py", "console": "integratedTerminal", "justMyCode": false, - "preLaunchTask": "build" + "preLaunchTask": "build", + "env": { + "ERROR_UNCATCHED": "True" + } } ] } diff --git a/test/python/test_serialize.py b/test/python/test_serialize.py index 78567a9..70f733f 100644 --- a/test/python/test_serialize.py +++ b/test/python/test_serialize.py @@ -9,6 +9,8 @@ from pathlib import Path logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)s %(message)s") logger = logging.getLogger("test_serialize") +ERROR_UNCATCHED = os.environ.get("ERROR_UNCATCHED", "false").lower() == "true" + if Path("cookie.json").exists(): with open("cookie.json", "r") as f: cookies = json.load(f) @@ -65,11 +67,14 @@ for x in [pt.DefaultApi, pt.TweetApi, pt.UserApi, pt.UserListApi]: try: res = getattr(x(api_client), props)(**kwargs) except Exception as e: - logger.error(f"{key}") - logger.error(e) + if ERROR_UNCATCHED: + raise e import traceback - logger.error(traceback.print_exc()) + logger.error("==========[STACK TRACE]==========") + for trace in traceback.format_exc().split("\n"): + logger.error(trace) + logger.info("================================") error_count += 1 if error_count > 0: