1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Add custom test results to report

Discussão em 'Python' iniciado por Stack, Setembro 8, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using pytest-html to generate my HTML report. My test record tested values and I need to show a table of this values with prettytable in case of success. I think that I need to implement this hook:

    @pytest.mark.optionalhook
    def pytest_html_results_table_html(report, data):
    if report.passed:
    del data[:]
    data.append(my_pretty_table_string)
    # or data.append(report.extra.text)


    But how to pass my_pretty_table_string to the hook function or how to edit report.extra.text from my test function?

    Continue reading...

Compartilhe esta Página