https://pantsbuild.org/ logo
#development
Title
# development
m

melodic-thailand-99227

10/31/2021, 3:32 PM
Does pants* know how to use xdist?
Found the relevant docs
e

enough-analyst-54434

10/31/2021, 3:34 PM
It does not. It runs each test file in parallel with all others. It cannot, however run each test within a file in parallel like xdist can.
So if you have a huge test file with lots of slow tests, that will be the long pole.
m

melodic-thailand-99227

10/31/2021, 3:35 PM
Can I get a worker from pants?
Or better, can I tell if pants is running me?
e

enough-analyst-54434

10/31/2021, 3:36 PM
I'm not sure what you mean by a worker - can you explain more?
m

melodic-thailand-99227

10/31/2021, 3:37 PM
Context: I’m using
pytest-django
which creates a different db for each worker
e

enough-analyst-54434

10/31/2021, 3:37 PM
Ah, gotcha - we expose an environment variable for things like this - just a sec...
You want to confgure an environment variable name in your pants.toml for `[pytest] execution_slot_var`: https://www.pantsbuild.org/docs/reference-pytest#section-execution-slot-var
m

melodic-thailand-99227

10/31/2021, 3:44 PM
Seems to work! Thanks!
e

enough-analyst-54434

10/31/2021, 3:45 PM
I'm not too Django literate, but we do want to support Django as best possible; so if you find anything hard or confusing to do - please file issues or ask.