Skip to content

Commit abc5914

Browse files
committed
Fix dashboard issue caused by pytest-rerunfailures
1 parent 05210fc commit abc5914

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6776,10 +6776,18 @@ def __process_dashboard(self, has_exception, init=False):
67766776
sb_config.item_count_untested -= 1
67776777
sb_config._results[test_id] = "Skipped"
67786778
elif has_exception:
6779-
sb_config._results[test_id] = "Failed"
6780-
sb_config.item_count_failed += 1
6781-
sb_config.item_count_untested -= 1
6779+
# pytest-rerunfailures may cause duplicate results
6780+
if test_id not in sb_config._results.keys() or (
6781+
(not sb_config._results[test_id] == "Failed")):
6782+
sb_config._results[test_id] = "Failed"
6783+
sb_config.item_count_failed += 1
6784+
sb_config.item_count_untested -= 1
67826785
else:
6786+
if test_id in sb_config._results.keys() and (
6787+
sb_config._results[test_id] == "Failed"):
6788+
# Possibly pytest-rerunfailures reran the test
6789+
sb_config.item_count_failed -= 1
6790+
sb_config.item_count_untested += 1
67836791
sb_config._results[test_id] = "Passed"
67846792
sb_config.item_count_passed += 1
67856793
sb_config.item_count_untested -= 1

seleniumbase/plugins/pytest_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ def pytest_runtest_makereport(item, call):
866866
sb_config._results[test_id] = r_outcome
867867
sb_config._duration[test_id] = "*****"
868868
sb_config._display_id[test_id] = display_id
869-
sb_config._extra_dash_entries.append(test_id)
869+
if test_id not in sb_config._extra_dash_entries:
870+
sb_config._extra_dash_entries.append(test_id)
870871
try:
871872
extra_report = None
872873
if hasattr(item, "_testcase"):

0 commit comments

Comments
 (0)