Basic Python and Java testing and running issues #19345
-
Hello everybody! I'm brand new to Pants and have mostly managed to get it going thanks to the documentation, except for a couple of things. Please see this basic repo (initial commit 2e6c976) with Python and Java code. Three issues:
Any advice would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Pants is working as intended. Your issue is that your python tests contain no test functions. Pytest expects test functions to start with |
Beta Was this translation helpful? Give feedback.
-
Or there is probably pytest config to change the test discovery pattern, but again that is a pytest thing, not a Pants thing. |
Beta Was this translation helpful? Give feedback.
-
For completeness, the immediate solutions were:
But I've made a few other changes, which required adding an explicit dependency |
Beta Was this translation helpful? Give feedback.
For completeness, the immediate solutions were:
test_
in order for Pytest to recognise them.entry_point
ofpex_binary
in the Python app BUILD file to refer to the function.:lineprinter
to thedeploy_jar
in the Java app BUILD file.But I've made a few other changes, which required adding an explicit dependency
:line_printer
topex_binary
too (commit b79f589). Now you can run the apps (which now take arguments) withpants run src/python/app/line_printer:lp -- 2 3 4
andpants run src/java/app/lineprinter:lp -- 2 3 4
.