Skip to content

Commit

Permalink
Fail only on newly failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-scherbakov committed Feb 4, 2024
1 parent 59adfd8 commit 91acb66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
name: pytest
path: tests/artifacts/pytest.xml
reporter: jest-junit
reporter: java-junit

- name: Upload pytest.xml
if: github.ref == 'refs/heads/master'
Expand Down
39 changes: 1 addition & 38 deletions jeeves.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def ci():
artifacts = Path(__file__).parent / 'tests/artifacts'
pytest_xml = artifacts / 'pytest.xml'

tests_success = True
try:
pytest.bake(
color='no',
Expand All @@ -94,7 +93,6 @@ def ci():
except ErrorReturnCode as err:
print(err.stdout)
print(err.stderr)
tests_success = False

with pytest_xml.open() as current_xml_data:
current_test_report = dict(_parse_pytest_xml(current_xml_data))
Expand Down Expand Up @@ -152,40 +150,5 @@ def ci():
else:
raise

if not tests_success:
if newly_failed:
raise typer.Exit(1)

"""
*lines, summary_line = err.stdout.decode().splitlines()
failures = [
line.replace('FAILED tests/', '').split(' - ')
for line in sorted(lines)
if line.startswith('FAILED')
]
new_comment = COMMENT_TEMPLATE.format(
summary=summary_line,
failures=details(
summary('Test Results'),
table(
thead(
tr(
td('Test'),
td('Error'),
),
),
tbody(
tr(
td(
'🔴',
code(test_name),
),
td(code(error_text)),
)
for test_name, error_text in failures
),
)
)
)
"""

0 comments on commit 91acb66

Please sign in to comment.