From 5fcb72717569b01f0359c3655a88b4ee85fc44ea Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Mon, 29 Apr 2024 11:12:40 +0200 Subject: [PATCH] coolu pdates --- .circleci/create_circleci_config.py | 6 +++--- .circleci/parse_test_outputs.py | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index d0d7a5deea8210..cb7f226e75a0c5 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -192,9 +192,9 @@ def to_dict(self): test_command = f"({test_command} | tee tests_output.txt) || true" steps.append({"run": {"name": "Run tests", "command": test_command}}) - steps.append({"run": {"name": "Show skip reasons", "command": f"python3 .circleci/parse_test_outputs.py --file ~/transformers/tests_output.txt --skip"}}) - steps.append({"run": {"name": "Show fail reasons", "command": f"python3 .circleci/parse_test_outputs.py --file ~/transformers/tests_output.txt --fail"}}) - steps.append({"run": {"name": "Show errors", "command": f"python3 .circleci/parse_test_outputs.py --file ~/transformers/tests_output.txt --errors"}}) + steps.append({"run": {"name": "Show skip reasons", "command": f"python3 .circleci/parse_test_outputs.py --file ~/transformers/tests_output.txt --skip || true"}}) + steps.append({"run": {"name": "Show fail reasons", "command": f"python3 .circleci/parse_test_outputs.py --file ~/transformers/tests_output.txt --fail || true"}}) + steps.append({"run": {"name": "Show errors", "command": f"python3 .circleci/parse_test_outputs.py --file ~/transformers/tests_output.txt --errors || true"}}) steps.append({"store_test_results": {"path": "test-results"}}) steps.append({"store_artifacts": {"path": "~/transformers/tests_output.txt"}}) diff --git a/.circleci/parse_test_outputs.py b/.circleci/parse_test_outputs.py index dc50813a021164..037fcdd330812a 100644 --- a/.circleci/parse_test_outputs.py +++ b/.circleci/parse_test_outputs.py @@ -6,7 +6,7 @@ def parse_pytest_output(file_path): skipped_count = 0 with open(file_path, 'r') as file: for line in file: - match = re.match(r'^SKIPPED \[(\d+)\] (tests/[^/]+/[^:]+):(\d+): (.*)$', line) + match = re.match(r'^SKIPPED \[(\d+)\] (tests/.*): (.*)$', line) if match: skipped_count += 1 _, test_file, test_line, reason = match.groups() @@ -18,12 +18,10 @@ def parse_pytest_output(file_path): exit(0) def parse_pytest_failure_output(file_path): - print(file_path) skipped_tests = {} skipped_count = 0 with open(file_path, 'r') as file: for line in file: - print(line) match = re.match(r'^FAILED (tests/.*) - (.*): (.*)$', line) if match: skipped_count += 1 @@ -42,13 +40,12 @@ def parse_pytest_errors_output(file_path): skipped_count = 0 with open(file_path, 'r') as file: for line in file: - print(line) match = re.match(r'^ERROR (tests/.*) - (.*): (.*)$', line) if match: skipped_count += 1 print(match.groups()) - _, test_file, test_line, reason = match.groups() - skipped_tests[reason] = skipped_tests.get(reason, []) + [(test_file, test_line)] + test_file, test_error, reason = match.groups() + skipped_tests[reason] = skipped_tests.get(reason, []) + [(test_file, test_error)] print("Number of skipped tests:", skipped_count) for k,v in sorted(skipped_tests.items(), key=lambda x:len(x[1])): print(f"{len(v):4} skipped because: {k}")