Skip to content

Slashes in parametrization values get turned into backslashes on Windows #12745

Closed
@The-Compiler

Description

@The-Compiler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: windowswindows platform-specific problemtopic: reportingrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions