Is it possible to run coverage reports and return ...
# general
i
Is it possible to run coverage reports and return an exit code if a threshold is not met? I'd like to have test goal fail based on a percent configured per test target.
h
https://www.pantsbuild.org/docs/reference-coverage-py#section-fail-under It'd be very appreciated if you wanted to try adding a small callout about this to https://www.pantsbuild.org/docs/python-test-goal#coverage as well. To suggest edits, click the button in the top right corner. Doesn't need to be perfect, we can help edit 🙂
i
Awesome. Thanks, Eric. What we've done in our Go applications is save coverage to a file and parse it with perl.
I should note we currently only have python & shell test targets. We may have Go & Scala soon. Having this for python is what I need atm... but may need it for other languages in the future.
👍 1
h
Go and Scala don't yet have coverage support - please do feel free to open up feature requests at https://github.com/pantsbuild/pants/issues/new/choose 🙂 especially helpful is sharing how you're doing it now. Usually the hardest part of new features is scoping out how to do it w/o Pants - it's fairly mechanical to port after that
shell test targets.
This makes me so happy to hear you're using Shell test support! I'd love to hear more about that - for example, did you have tests before using Pants?
i
we are going to be porting over the shell script over to python because it's less than ideal. Too many edge cases to cover. It was more of a proof of concept than anything else.
h
Interesting. What challenges are you running into?
i
primarily readability.
👍 1
f