Skip to content

Windows target determination can miss Git-style test paths #188829

Description

@VectorPeak

🐛 Describe the bug

python_test_file_to_test_name() in target-determination heuristics matches changed test files with test{os.path.sep}. On Windows, that prefix is test\, but changed-file paths from Git/GitHub APIs are slash-style, such as test/test_jit.py.

As a result, Windows runs can miss directly changed test/*.py files when converting changed paths into test names for target-determination heuristics.

Versions

Current main at the time of filing.

Minimal reproduction

On Windows, os.path.sep == "\\", so this helper does not recognize a Git-style test path:

python_test_file_to_test_name({"test/test_jit.py"})

Expected:

{"test_jit"}

Actual with the current separator-specific prefix:

set()

Impact

The helper is used by target-determination heuristics such as EditedByPR and PreviouslyFailedInPR. Missing a directly changed test file weakens test prioritization on Windows.

Suggested fix

Normalize path separators in the helper before matching the stable repo-relative test/ prefix, while preserving existing behavior for slash-style paths.

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @nkhasbag-nv @malfet @pytorch/pytorch-dev-infra

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot-triagedThis is a label only to be used by the auto triage botmodule: ciRelated to continuous integrationmodule: windowsWindows support for PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions