pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Slashes in parametrization values get turned into backslashes on Windows

Open The-Compiler opened this issue 1 year ago • 0 comments

With pytest 8.3.2 as well as the current main, when creating a repro/test_x.py in the pytest repo:

import pytest

@pytest.mark.parametrize("a", ["x/y", "/", "//"])
def test_x(a):
    assert False

and running pytest test_x.py inside repro/, both in the -v output and short test summary, the tests show up as:

test_x.py::test_x[x\y]
test_x.py::test_x[\]
test_x.py::test_x[\]

The IDs show up correctly in --collect-only, and they show correctly when test_x.py is not in a subfolder, or when pytest is not invoked in the subfolder.

The-Compiler avatar Aug 28 '24 07:08 The-Compiler