Skip to content

Write Markdown coverage reports as UTF-8 - #774

Open
anticipate218 wants to merge 1 commit into
pytest-dev:masterfrom
anticipate218:fix/utf8-markdown-reports
Open

anticipate218 wants to merge 1 commit into
pytest-dev:masterfrom
anticipate218:fix/utf8-markdown-reports

Conversation

@anticipate218

Copy link
Copy Markdown

Write both Markdown report modes as UTF-8. On a Windows process with UTF-8 mode disabled, a passing test in a source file with an emoji filename currently ends with an internal UnicodeEncodeError and exit code 3 while generating either markdown or markdown-append. The report streams use the locale encoding because Path.open() has no explicit encoding.

This changes only the encoding of those two report streams. The regression exercises real report generation with an ASCII default opener and checks the Unicode filename and append preservation. Changelog and author credits are included as requested by the contribution guide. Existing non-UTF-8 Markdown files are not transcoded.

Related: #772 updates precision in the neighboring reporting calls; this change leaves precision and coverage calculations unchanged.

Validation: the final regression fails in both modes on the original source. The full local suite passes (214 passed, 6 existing Windows skips), as do Ruff, applicable configured file checks, Sphinx HTML, sdist/wheel builds and twine strict. The complete tox/prek wrappers and other Python/OS combinations were not run. Sphinx linkcheck was stopped at 240 seconds after repeated GitHub connection timeouts and is not claimed as passing. Independent Windows CLI checks covered UTF-8 mode on/off, ASCII/emoji source filenames, a Unicode report path, and preservation/replacement of an existing UTF-8 prefix. Other platforms, Python versions, and the full tox environment matrix were not run.

AI assistance: Codex prepared this change and tests. A separate agent reviewed the implementation and ran independent CLI checks.

Use UTF-8 for Markdown report files so non-ASCII source filenames cannot crash reporting under a legacy locale encoding.

Assisted-by: OpenAI Codex
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

Successfully merging this pull request may close these issues.

1 participant