pytest-html does not escape HTML in testId (v4.2.0)
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- html, python
- Domain
- testing-qa
Research direction
Start by running the supplied parametrized Python test and inspecting the generated pytest-html report. The issue names no repository file or test to begin with, so trace how the testId is inserted into the report. Done means the report consistently renders the testId as literal text rather than interpreting its HTML markup.
Written by the indexing model from the issue text.
Description
Hello,
I created a parametrize test where testId contains the following text:
<span style="font-weight: bold; color: red; font-size: 2em;">text</span>
pytest-html generated the next report:
Is it an expected behaviour?
Test code:
import pytest
@pytest.mark.parametrize(
"data",
[
'<span style="font-weight: bold; color: red; font-size: 2em;">text</span>',
],
)
def test_unescape(data): print("ha-ha")
- Dominant language
- Python
- Stars
- 779
- Forks
- 261
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pytest-dev/pytest-html
-
test_rerun integration tests fail with pytest-rerunfailures 16.7Possibly taken @nicozdeb claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
pytest-dev/pytest-html#1085 · 1 comment ·
-
HTML extras for 'call' and 'teardown' phases get mergedPossibly taken @contputer0x0 claimed this 22 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
pytest-dev/pytest-html#1077 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
pytest-dev/pytest-html#1039 ·
-
Feature: pluggable HTML themes via Jinja2 template inheritancePossibly taken @RonnyPfannschmidt claimed this 162 days ago. Open
pytest-dev/pytest-html#1029 · 1 reaction · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
pytest-dev/pytest-html#1027 ·
All issues in pytest-dev/pytest-html
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
yt-project/yt#5624 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NousResearch/hermes-agent#148376 ·
Maintainers usually reply within 1 day
-
Analysis
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SACGF/variantgrid#2615 ·
Maintainers usually reply within 1 day