https://pantsbuild.org/ logo
c

cold-soccer-63228

05/12/2022, 1:20 PM
I had two separate questions about the generation of
BUILD
files for
python_tests
targets. See the code snippets below for reference. ā€¢ Why is a
name
parameter generated at all? Why is this necessary? ā€¢ Why is it that sometimes a
"tests0"
string is (rarely) used for a name, whereas other times
"tests"
is used?
Copy code
# path/to/some/BUILD
python_tests(
    name="tests0",
)

# path/to/another/BUILD
python_tests(
    name="tests",
)
āœ… 1
n

narrow-vegetable-37489

05/12/2022, 1:24 PM
Name is needed so it can be referenced and targeted, otherwise Pants can't differentiate between e.g.
python_sources()
and
python_tests()
within a BUILD file.
šŸ‘ 1
h

hundreds-father-404

05/12/2022, 1:36 PM
Exactly, this section: https://www.pantsbuild.org/docs/targets#target-addresses. We need an unambiguous way to refer to each "target"
Re why it sometimes uses
tests0
, that means the name
tests
was already claimed in that directory
c

cold-soccer-63228

05/12/2022, 1:38 PM
I see. Thank you!
3 Views