Closed
Description
🐞 bug report
Affected Rule
The issue is caused by the rule: py_test
Is this a regression?
Unknown
Description
When using # gazelle:python_generation_mode project
, the Python Gazelle plugin still generates one py_test
target per file, but puts them all in the BUILD
file that has the python_generation_mode
directive in it. This can result in duplicate target names if two test files have the same filename (but are in different subdirectories), as the subdirectory path is not incorporated into the target names.
When using python_generation_mode project
, I would expect a single py_test
target for all of the tests across all of the subdirectories, just as with py_library
.
🔬 Minimal Reproduction
BUILD file:
# gazelle:python_generation_mode project
<usual gazelle targets here>
$ echo "# gazelle:python_generation_mode project" > BUILD.bazel
$ mkdir bar
$ touch bar/test_foo.py
$ mkdir baz
$ touch baz/test_foo.py
$ bazel run //:gazelle
gazelle: multiple rules found with label @test//:test_foo
🌍 Your Environment
Operating System:
macOS Sonoma
Output of bazel version
:
bazel 6.3.2
Rules_python version:
0.25.0
Metadata
Metadata
Assignees
Labels
No labels