pytest-dev / pytest-dev/pytest

Add test warning output to JUnit XML file

Open
#2,717 13 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: junitxml plugin: warnings type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

The new feature where pytest captures all the warnings and reports them after it runs is great. Unfortunately, those warnings do not appear in the JUnit XML file and that means that our CI system does not report the warnings to the user. Is it possible to capture the warnings from each and store them in the appropriate stderr section in the XML file? It seems like warnings are intercepted before they can be caught by the JUnit code. Making them visible to our CI users would motivate them to fix them.

Thanks again for pytest.

Contributor guide

Open the contributing guide

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 tracing how pytest captures warnings and how its JUnit XML reporter writes each test's output. Review the existing warning and JUnit reporting tests, if present, before deciding where the data should connect. Done means warnings appear in the appropriate stderr section of the JUnit XML and remain visible to CI users.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.