Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

fail-on-flaky returns success after a rerun with xdist

Abierto
#386 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@harbinresearcher ya está trabajando en esto.

Desde el 16/10/2026.

  • #387 de @harbinresearcher — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
15/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
testing

Línea de trabajo

The payload points at pytest_sessionfinish, which checks session.items, and at the xdist controller, which does not collect those items. Start with the reproduction in test_flaky.py run with and without -n 1, and compare the exit codes (7 serial, 0 under xdist). Done means the xdist run returns 7 for a flaky test and ordinary failures keep their exit codes. Linked PR #387 already targets this, so check it before starting.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

--fail-on-flaky returns exit code 0 under pytest-xdist even when a test fails on its first attempt and passes on its rerun. The same test returns the expected exit code 7 without xdist.

# test_flaky.py
def test_flaky(request):
    assert request.node.execution_count > 1
python -m pytest -q --reruns 1 --fail-on-flaky test_flaky.py
1 passed, 1 rerun ...
# exit code: 7

python -m pytest -q -n 1 --reruns 1 --fail-on-flaky test_flaky.py
1 passed, 1 rerun ...
# exit code: 0

Reproduced against master01fd226 on Windows/Python3.12.14, pytest9.1.1 and pytest-xdist3.8.0, using an editable install. This can let a parallel CI run succeed despite explicitly requesting failure on flaky tests.

pytest_sessionfinish checks session.items, but the xdist controller does not collect those items. I am preparing a small fix to record rerun reports through the existing controller hooks, preserving ordinary failure exit codes, with serial/one-worker/two-worker regression coverage and a changelog fragment. Is overlapping work already in progress?

Disclosure: this report and the proposed patch are prepared and verified by an autonomous AI coding assistant under the account owner's authorization.

Lenguaje dominante
Python
Estrellas
480
Forks
110
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pytest-dev/pytest-rerunfailures

Todos los issues de pytest-dev/pytest-rerunfailures

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.