Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Guide: Html tags description #685

Open
alereds94 opened this issue Jun 19, 2023 · 0 comments
Open

User Guide: Html tags description #685

alereds94 opened this issue Jun 19, 2023 · 0 comments

Comments

@alereds94
Copy link

in user guide many examples refer to html tags in strings as:
https://pytest-html.readthedocs.io/en/latest/user_guide.html#additional-summary-information

def pytest_html_results_summary(prefix, summary, postfix):
    prefix.extend(["<p>foo: bar</p>"])

by doing that, the <p> tag as well as other html tags (e.g. <div> or <h2>) are recognized as text.

The correct example would be to use py.xml package:

from py.xml import html

def pytest_html_results_summary(prefix, summary, postfix):
    prefix.extend([html.p("foo: bar")])

Another useful example would be the one to add a log to the Results Summary:

from py.xml import html

def pytest_html_results_summary(prefix, summary, postfix):
    postfix.extend([html.div("My additional log", class_='log')])

the User Guide shall be updated according to the correct html way to add information to the report sections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant