Skip to content

Commit

Permalink
fix test failures and for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Shlomi Amit committed Mar 7, 2024
1 parent 6937bc1 commit 13eb22d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/pytest_rerunfailures.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,18 +551,23 @@ def pytest_runtest_protocol(item, nextitem):
# Check all reports to see if any rerun is needed
# (So teardown report is checked before processing call (test))
except_found = False
for r in reports:
for report in reports:
rerun_except_errors = _get_rerun_filter_regex(item, "rerun_except")
except_found = rerun_except_errors and _matches_any_rerun_except_error(
rerun_except_errors, r
rerun_except_errors, report
)
if except_found:
# One of the reports has rerun_except error match,
# no need to scan the other reports
break

should_not_rerun = True
for r in reports:
r.rerun = item.execution_count - 1
should_not_rerun = _should_not_rerun(item, r, reruns) or except_found
for report in reports:
report.rerun = item.execution_count - 1
should_not_rerun = _should_not_rerun(item, report, reruns) or except_found
if not should_not_rerun:
# One of the reports should rerun, no need to scan the other reports
break

for report in reports: # 3 reports: setup, call, teardown
if should_not_rerun:
Expand Down

0 comments on commit 13eb22d

Please sign in to comment.