high-yak-85899
09/21/2023, 12:32 AMtest_*.py
or *_test.py
. We exclusively use the latter and the former is always a python_source
for us. Is there a way to globally teach Pants this about our repo? I think __defaults__
gets us partially there, but I think pants tailor
still looks at the builtin behavior when helping create targets.high-yak-85899
09/21/2023, 12:37 AMtest_something.py
)
# Here is my super important module
def main() -> None:
print('Hello world')
Add a BUILD
file that instructs this to not be owned a python_test
target
__defaults__({python_tests: {"sources": ["*_test.py"]}})
Run pants tailor ::
and see that it wants to make a python_tests
target in the BUILD
file
$ pants tailor ::
Updated path/to/BUILD.pants:
- Add python_tests target tests
See that any goal (list
is easy enough) complains about not finding sources for the newly added target
$ pants list path/to/test_something.py
18:35:47.73 [ERROR] 1 Exception encountered:
Engine traceback:
in `list` goal
in Find targets from input specs
IntrinsicError: Unmatched glob from path/to:tests's `sources` field: "path/to/*_test.py"
Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to <https://www.pantsbuild.org/v2.16/docs/troubleshooting#pants-cannot-find-a-file-in-your-project>.
broad-processor-92400
09/21/2023, 1:29 AM__default__
for python_sources
too? tailor
won't add new targets for files that are owned, and that config makes it sound like test_something.py
isn't associated with any target?high-yak-85899
09/21/2023, 1:33 AMhappy-kitchen-89482
09/21/2023, 6:44 AMhappy-kitchen-89482
09/21/2023, 6:44 AM