Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The attachments are not in the Nunit report when using pytest-xdist #80

Open
anastasia-vlasova-gmg opened this issue Nov 13, 2024 · 0 comments

Comments

@anastasia-vlasova-gmg
Copy link

The environment:

  • pytest=8.2.2
  • pytest-nunit=1.0.7
  • pytest-xdist=3.6.1
  • python=3.10.8

The script:

import pytest

@pytest.mark.parametrize("params", [(1, 1),(2, 1)])
def test_temp(params, add_nunit_attachment):

    p = f"{str(params[0])}.txt"
    with open(p, "tw") as f:
        f.write("")
    add_nunit_attachment(p, p)
    assert params[0] == params[1]

The script when run without arguments produces test-output.xml containing:

<attachments>
  <attachment>
    <filePath>1.txt</filePath>
    <description>1.txt</description>
  </attachment>
</attachments>

as expected.

When run with -n 2 (2 xdist workers) produces test-output.xml with no attachments.

I don't see this behavior mentioned in the known limitations at the moment.
We use pytest-azurepipelines to run tests in CI and publishing attachments of the failing tests resulting files is a very useful instrument of the test failure diagnostics.

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

No branches or pull requests

1 participant