Skip to content

Commit

Permalink
coolu pdates
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Apr 29, 2024
1 parent fef09d3 commit 5fcb727
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}})
Expand Down
9 changes: 3 additions & 6 deletions .circleci/parse_test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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}")
Expand Down

0 comments on commit 5fcb727

Please sign in to comment.