From a9619ee0069ecfec55020d006334f095dddcc5b7 Mon Sep 17 00:00:00 2001 From: Zhan Rongrui <2742392377@qq.com> Date: Thu, 6 Jul 2023 13:56:15 +0000 Subject: [PATCH] fix bug --- tests/extract_errors.py | 14 +++++++------- tests/run_all.sh | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/extract_errors.py b/tests/extract_errors.py index 43ebbb55e..9c20b8065 100644 --- a/tests/extract_errors.py +++ b/tests/extract_errors.py @@ -6,10 +6,10 @@ pattern = r'File "?(.*?)"?, line (\d+),.*\n(.*?)\n(.*?)$' for match in re.finditer(pattern, error_msg, re.MULTILINE): file = match.group(1) - if not file.startswith("/"): - file = f"tests/{file}" - line = match.group(2) - error_info = match.group(4) - # error_info = match.group(3) + '\n' + match.group(4) - output = f"::error file={file},line={line}::{error_info}" - print(output) + if file.startswith("./"): + file = f"tests/{file[2:]}" + line = match.group(2) + error_info = match.group(4) + # error_info = match.group(3) + '\n' + match.group(4) + output = f"::error file={file},line={line}::{error_info}" + print(output) diff --git a/tests/run_all.sh b/tests/run_all.sh index 9fc82fcfa..fc90f898e 100644 --- a/tests/run_all.sh +++ b/tests/run_all.sh @@ -1,11 +1,11 @@ -# 遍历目录下的所有 Python 文件 +# 遍历目录下的所有 python 文件 export PYTHONPATH=$PYTHONPATH:../ export STRICT_MODE=1 failed_tests=() for file in ./test_*.py; do - # 检查文件是否为 Python 文件 + # 检查文件是否为 python 文件 if [ -f "$file" ]; then if [[ -n "$GITHUB_ACTIONS" ]]; then echo ::group::Running: PYTHONPATH=$PYTHONPATH " STRICT_MODE=1 python " $file @@ -19,9 +19,9 @@ for file in ./test_*.py; do echo "run $file failed" failed_tests+=("$file") if [[ -n "$GITHUB_ACTIONS" ]]; then - echo $python_output | python ./extract_errors.py + echo -e "$python_output" | python ./extract_errors.py fi - echo $python_output + echo -e "$python_output" fi if [[ -n "$GITHUB_ACTIONS" ]]; then echo "::endgroup::"