Skip to content

junitxml: use forward slashes in the testcase file attribute - #15454

Open
surkuar wants to merge 1 commit into
pytest-dev:mainfrom
surkuar:junitxml-file-forward-slashes
Open

surkuar wants to merge 1 commit into
pytest-dev:mainfrom
surkuar:junitxml-file-forward-slashes

Conversation

@surkuar

@surkuar surkuar commented Nov 25, 2026

Copy link
Copy Markdown

Closes #15453

With junit_family=xunit1 (or legacy), the file attribute of <testcase> was taken directly from Item.location, which uses os.sep. On Windows it therefore contained backslashes (tests\sub\test_plain.py) while the nodeid for the same test uses /, so one suite produced different file values depending on the OS that ran it.

This normalizes the separator to nodes.SEP in junitxml only, so Item.location and terminal output on Windows are unchanged.

  • Added test_file_uses_forward_slashes in testing/test_junitxml.py (fails on Windows without the fix)
  • Added changelog/15453.bugfix.rst
  • Added myself to AUTHORS
  • Allow maintainers to push and squash when merging my commits.

The file attribute (xunit1/legacy families) came from Item.location,
which uses os.sep, so reports produced on Windows contained backslashes
while the nodeid uses '/'. Normalize to nodes.SEP in junitxml only, so
terminal output is unchanged.

Fixes pytest-dev#15453
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 25, 2026
@surkuar
surkuar force-pushed the junitxml-file-forward-slashes branch from d012c26 to c06ded0 Compare November 25, 2026 03:12

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

junitxml: file attribute uses backslashes on Windows (xunit1/legacy)

2 participants