Skip to content

Commit b2516c5

Browse files
committed
Ignore failures that are retried using pytest-rerunfailures plugin
This change will not annotate test failures when there retries left to run via [`pytest-rerunfailures`](https://pypi.org/project/pytest-rerunfailures/) plugin
1 parent 7e1ec1f commit b2516c5

File tree

1 file changed

+9
-0
lines changed
  • pytest_github_actions_annotate_failures

1 file changed

+9
-0
lines changed

pytest_github_actions_annotate_failures/plugin.py

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ def pytest_runtest_makereport(item, call):
2727
if os.environ.get("GITHUB_ACTIONS") != "true":
2828
return
2929

30+
try:
31+
# If we have the pytest_rerunfailures plugin, and there are still
32+
# retries to be run, then ignore error
33+
import pytest_rerunfailures
34+
if item.execution_count <= pytest_rerunfailures.get_reruns_count(item):
35+
return
36+
except ImportError:
37+
pass
38+
3039
if report.when == "call" and report.failed:
3140
# collect information to be annotated
3241
filesystempath, lineno, _ = report.location

0 commit comments

Comments
 (0)