For the Pants `test` goal to run Python tests (<ht...
# general
a
For the Pants
test
goal to run Python tests (https://www.pantsbuild.org/docs/python-test-goal), is there an option to do more than one run per test? The context is that I want to do periodic runs in CI where all unit tests are reran forcefully (i.e., with the
--force
option) in order to help catch unit test flakiness. I also would like to do more than one run per test. For comparison, in Bazel one can do
--runs_per_test=<n> --cache_test_results=no
, which fits the ask perfectly. However, Pants doesn't seem to have the option to do more than forceful run per test. I suppose one could do something such as wrap
./pants test --force ::
in a Bash loop (
for i in {1..<n>}; do ./pants test --force ::; done
), but that feels clunky.
b
There's likely a pytest plugin for that if you're in Python land. We do something similar for rerun on fiakure
a
It looks like there's a
pytest-repeat
plugin: https://pypi.org/project/pytest-repeat/. However, the project description page rules out support with
unittest.TestCase
test classes outright, which would be a deal breaker.
b
I suspect that's a limitation of pytest trying not to overstep when running unittest tests 😕
These features wouldn't be too hard to add. Feel free to file an issue. Also, we'd love to shepherd you along if you're interested in contributing!
a
Let me know how I can help with this feature request and I would be willing to do so.