HTML extras for 'call' and 'teardown' phases get merged
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- testing-qa
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 779
- Fork
- 259
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pytest-dev/pytest-html
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
pytest-dev/pytest-html#1039 ·
-
Feature: pluggable HTML themes via Jinja2 template inheritanceForse già presa @RonnyPfannschmidt l’ha presa 136 giorni fa. Aperta
pytest-dev/pytest-html#1029 · 1 reazione · 1 assegnatario ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
pytest-dev/pytest-html#1027 ·
-
pytest-html does not escape HTML in testId (v4.2.0)Forse già presa @golikovichev l’ha presa 120 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
pytest-dev/pytest-html#1024 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
pytest-dev/pytest-html#1010 ·
Tutte le issue di pytest-dev/pytest-html
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
SR_SECURITY_DESCRIPTOR.fromString drops the SACL when no DACL is presentForse già presa @paul7436 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
equinor/fmu-sumo-uploader#302 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelscope/evalscope#1821 ·
I maintainer di solito rispondono entro 1 giorno
-
Sanity on ansible-core devel fails: ignore-2.23.txt references the removed import-3.9 testForse già presa @yurnov l’ha presa oggi. Apertaneeds_triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
ansible-collections/kubernetes.core#1275 ·
I maintainer di solito rispondono entro 1 giorno