HTML extras for 'call' and 'teardown' phases get merged
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- testing-qa
Línea de trabajo
Reproduce the regression with the provided conftest.py and bug_test.py files, using the pytest-html report output as the starting point. Compare how extras are collected for the call and teardown phases, then verify that each report displays only its own phase's HTML extra and that the regression is covered by a test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The extras added during the call and teardown phases get merged and are displayed in both call and teardown HTML reports
Use this conftest.py file:
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
pytest_html = item.config.pluginmanager.getplugin("html")
report = outcome.get_result()
extras = getattr(report, "extras", [])
if (
report.when in ("setup", "teardown") and
report.outcome in ('failed', 'skipped')
):
extras.append(pytest_html.extras.html(f'<p>We are in {report.when} phase</p>'))
if report.when == "call":
extras.append(pytest_html.extras.html(f'<p>We are in {report.when} phase</p>'))
report.extras = extras
Use this bug_test.py file:
import pytest
@pytest.fixture
def teardown():
yield
assert False
def test_extras(teardown):
pass
Run the test
Actual result:
The extras for call and teardown are merged and are displayed in both call and teardown reports
Expected result:
- The
callreport only displays the extras added during thecallphase (<p>We are in call phase</p>) - The
teardownreport only displays the extras added during theteardownphase (<p>We are in teardown phase</p>)
This is a regression. We didn't have this bug in pytest-html==4.0.0
- Lenguaje dominante
- Python
- Estrellas
- 779
- Forks
- 259
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytest-dev/pytest-html
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
pytest-dev/pytest-html#1039 ·
-
Feature: pluggable HTML themes via Jinja2 template inheritancePosiblemente ocupada @RonnyPfannschmidt la tomó hace 136 días. Abierto
pytest-dev/pytest-html#1029 · 1 reacción · 1 asignado ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
pytest-dev/pytest-html#1027 ·
-
pytest-html does not escape HTML in testId (v4.2.0)Posiblemente ocupada @golikovichev la tomó hace 120 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
pytest-dev/pytest-html#1024 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
pytest-dev/pytest-html#1010 ·
Todos los issues de pytest-dev/pytest-html
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
rpm-software-management/mock#1824 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
jpata/particleflow#520 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue hacktoberfest
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
gridhead/gi-loadouts#699 ·
Los mantenedores suelen responder en 13 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
FinanceFlash/unvibecode#206 ·
Los mantenedores suelen responder en 1 día