test_rerun integration tests fail with pytest-rerunfailures 16.7

Open Beginner friendly
#1,085 1 comment 0 reactions 0 assignees View on GitHub

@nicozdeb is already working on this.

Since Oct 30, 2026.

  • #1086 by @nicozdeb — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing

Research direction

Start in basereport.py at pytest_runtest_logreport and follow how stored reports are accumulated and when the report is treated as finished; the issue says these are processed without being cleared at the first non-rerun teardown. Reproduce with testing/test_integration.py::TestHTML::test_rerun and TestLogCapturing::test_rerun under pytest-rerunfailures 16.7, then confirm the rerun count reads 2 rather than 5 after the teardown-per-attempt sequence.

Written by the indexing model from the issue text.

Description

With pytest-rerunfailures 16.7, both rerun integration tests fail:

FAILED testing/test_integration.py::TestHTML::test_rerun - AssertionError: Expected <5 Reruns> to match pattern <2 Reruns>, but did not.
FAILED testing/test_integration.py::TestLogCapturing::test_rerun - AssertionError: Expected <5 Reruns> to match pattern <2 Reruns>, but did not.

The test uses @pytest.mark.flaky(reruns=2) but the report shows 5 reruns.
Same result with the app.js/style.css shipped in the 4.2.0 sdist, so it
is not related to the frontend build.

Bisected: it starts with pytest-rerunfailures 16.7, which now runs and
reports teardown after each failed attempt
(setup, call:rerun, teardown, setup, call:rerun, teardown, ...).

pytest_runtest_logreport in basereport.py treats the first non-rerun
teardown as "finished" and processes all stored reports without
clearing them, so reruns are processed again at each teardown:
1 + 2 + 2 = 5 "Rerun" rows (3 of them with 0 ms duration).

Environment: pytest-html 4.2.0, pytest 9.1.1, pytest-rerunfailures 16.7,
Python 3.14, Debian unstable, chromium + chromedriver.

Dominant language
Python
Stars
779
Forks
261
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pytest-dev/pytest-html

All issues in pytest-dev/pytest-html

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.