pytest-dev / pytest-dev/pytest-html

User Guide: Html tags description

Open
#685 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
779
Forks
260
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the User Guide at the Additional Summary Information section linked in the issue and review its HTML examples. Update the examples to use py.xml.html elements, including the results summary and additional log examples; done means the guide shows the corrected HTML construction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.