pytest-dev / pytest-dev/pytest-html

Html report not generated if logs include unicode character

Open
#677 10 comments 0 reactions 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

This test does not generate html report:

def test_encode(self):
       var = "just random print:"+"'\u200e'"        
       print(var)

But this test does:

def test_encode(self):
       var = "just random print:"+"'\u200e'"
       var = str(var.encode('utf-8'))
       print(var)

Is there any way to handle this from conftest.py? so that explicit encoding is not needed in every print statements?

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

Start by reproducing the two test_encode examples from the issue, first with the Unicode character printed directly and then with the explicit UTF-8 encoding. Inspect conftest.py and the HTML report generation path to find where the direct output fails. Done means the HTML report is generated for the direct Unicode print without requiring encoding in each test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.