Any good suggestion on testing python target in pa...
# general
p
Any good suggestion on testing python target in parallel?
h
Yes, the V2 test runner is optimized for this.
./pants --no-v1 --v2 test
. It will run each target as a separate process, limited by the global option
--process-execution-local-parallelism
. The caching is also much saner than the normal V1 test runner. For example, if target A changed, but target B is the same, you’ll immediately get back the result for B. Any intermediate work also gets cached. -- It’s still technically experimental. However, we’ve been using the V2 test runner in our internal CI for the past three months (along with remote execution for much higher parallelism) We recommend upgrading to the newest release of Pants for a better experience with the V2 test runner. We’re frequently making improvements, including a couple improvements that will go out in this weekend’s dev release.
👍 1
p
So for now do we have v2 on by default ?
Also the v2 engine works better for nodejs too?
h
No, V2 is currently off by default and V1 on by default. If you were to run
./pants --v2 test
, then you would end up running your Python tests with both V1 and V2 because we provide an implementation for both. What I do is have a script called
./v2
that just does this:
Copy code
export PANTS_V1=false
export PANTS_V2=true
./pants "$@"
When I want V1, I say
./pants test
and when I want V2 I say
./v2 test
pytest_run.py
is the V1 task. This is the V2 file:
<https://github.com/pantsbuild/pants/blob/master/src/python/pants/backend/python/rules/python_test_runner.py>
-- We don’t yet have V2 support for nodejs, but it’s in the medium term roadmap!
Oh one more thing, I think we made a change last week that to enable the V2 Python test runner, you need to add this to your `pants.ini`:
Copy code
[GLOBAL]
backend_packages2: +['pants.backend.python']
h
v2 is the future, so I recommend getting on board! We'll be happy to help with any issues.
💯 2
w
note: he said that, not me! 😉
but yea. very exciting stuff.