π bug report
Affected Rule
py_test / py_binary
Is this a regression?
Yes β v1 (which delegated to Bazel's native Python rules); this is part of our Selenium update to v2 (SeleniumHQ/selenium#17502)
Description
On Windows, the bootstrap stub is declared at python/private/py_executable.bzl:427 using executable.basename, which drops the directory component. The stub is therefore created relative to the package root rather than as a sibling of the .exe launcher. When a target name contains / (so Bazel writes the .exe into a nested output directory), the launcher cannot find the stub next to itself and execution fails.
π¬ Minimal Reproduction
A py_test whose name attribute contains /, e.g.:
py_test(
name = "test/unit/foo/color_tests-unit",
srcs = ["color_tests.py"],
)
Build on Windows and inspect the action output paths:
stub: bazel-out/x64_windows-fastbuild/bin/pkg/color_tests-unit
executable: bazel-out/x64_windows-fastbuild/bin/pkg/test/unit/foo/color_tests-unit.exe
π₯ Exception or Error
[Errno 2] No such file or directory
π Your Environment
Operating System:
Microsoft Windows Server 2025
Output of bazel version:
Rules_python version:
Anything else relevant?
PR incoming
π bug report
Affected Rule
py_test/py_binaryIs this a regression?
Yes β v1 (which delegated to Bazel's native Python rules); this is part of our Selenium update to v2 (SeleniumHQ/selenium#17502)
Description
On Windows, the bootstrap stub is declared at
python/private/py_executable.bzl:427usingexecutable.basename, which drops the directory component. The stub is therefore created relative to the package root rather than as a sibling of the.exelauncher. When a target name contains/(so Bazel writes the.exeinto a nested output directory), the launcher cannot find the stub next to itself and execution fails.π¬ Minimal Reproduction
A
py_testwhosenameattribute contains/, e.g.:Build on Windows and inspect the action output paths:
stub:
bazel-out/x64_windows-fastbuild/bin/pkg/color_tests-unitexecutable:
bazel-out/x64_windows-fastbuild/bin/pkg/test/unit/foo/color_tests-unit.exeπ₯ Exception or Error
π Your Environment
Operating System:
Output of
bazel version:Rules_python version:
Anything else relevant?
PR incoming