Hey folks! We are running into an issue attempting...
# general
g
Hey folks! We are running into an issue attempting to switch from pytest-xdist to pants for our tests.
pytest-xdist
runs individual tests in parallel but pants seems to only run test files in parallel. We have some big files with a lot of tests, so pants is much worse performance-wise. Am I missing any configuration options, or is this just the way pants works?
b
For now thats how pants works πŸ™‚ If there isn't already an issue feel free to make one with tons of info. Otherwise you might lightly suggest splitting those test files, unless you think engineers will lob objects and boo in your direction πŸ™‚
w
this issue covers implementing something like that: https://github.com/pantsbuild/pants/issues/15026 … it’s definitely possible, but would require shipping that change as well as improving our process-internal parallelism
f
I agree with Joshua -- I'd also suggest splitting large files into multiple ones. I find it to be very difficult to navigate around tests if there are more than a few hundred lines. It would also help if the unit tests are not stored in the same file(s) with integration tests so that the slower system tests are not causing the delay.
βž• 1
h
Hi @gentle-dentist-72404, your comments on https://github.com/pantsbuild/pants/issues/15026 would be helpful in understanding your use case and prioritizing the issue
a
Is there anything stopping someone from creating a
test-xdist
goal that collects all the sources for the selected targets and their dependencies and runs pytest on them w/ xdist installed?
you'd lose caching I guess. But you'd gain speed. And nothing stopping you from running the regular
test
goal against changed targets in dev, and your test-xdist goal in CICD
h
Nothing stops that per se, certainly nothing that implements it as a separate plugin, just questions about whether that's the right design, vs baking it into
test
and getting caching right
@gentle-dentist-72404 you should still be able to run with pytest-xdist under Pants, but then you may want to tweak the concurrency that Pants uses