pytest-dev / pytest-dev/pytest

record_xml_attribute not visible in JUnit XML when using pytest-xdist

Open
#8,654 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently pytest-xdist is working without a problem with record_property, but it does not save the values using record_xml_attribute fixture.

Here's the code to reproduce this issue

import pytest

def test_xdist_xml(record_xml_attribute):
    record_xml_attribute("key", 1)

I run this this test twice using following command:
py.test test_example.py --junit-xml=without_xdist.xml and then py.test test_example.py --junit-xml=with_xdist.xml -n auto

without_xdist.xml

<testcase classname="test_example" file="test_example.py" key="1" line="2" name="test_xdist_xml" time="0.001"></testcase>

with_xdist.xml

<testcase classname="test_example" file="test_example.py" line="2" name="test_xdist_xml" time="0.002"></testcase>

So it looks like key="1" is missing from junit XML when using xdist.

I've tested it using latest pytest (5.4.2) and pytest-xdist (1.32.0)
Thanks for any help.

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 with the test_example.py reproducer and run it once normally and once with pytest-xdist using the commands shown. Compare the generated JUnit XML and trace how record_xml_attribute data is handled across workers; done means the key="1" attribute is present in the xdist output as it is without xdist.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.