🐛 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:
Actual with the current separator-specific prefix:
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
🐛 Describe the bug
python_test_file_to_test_name()in target-determination heuristics matches changed test files withtest{os.path.sep}. On Windows, that prefix istest\, but changed-file paths from Git/GitHub APIs are slash-style, such astest/test_jit.py.As a result, Windows runs can miss directly changed
test/*.pyfiles when converting changed paths into test names for target-determination heuristics.Versions
Current
mainat the time of filing.Minimal reproduction
On Windows,
os.path.sep == "\\", so this helper does not recognize a Git-style test path:Expected:
{"test_jit"}Actual with the current separator-specific prefix:
set()Impact
The helper is used by target-determination heuristics such as
EditedByPRandPreviouslyFailedInPR. 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