To run parallel tests on mobile devices, I use pytest + xdist.
I want to run as many threads as I have connected devices, no more.
I pass "-n 4" as command line argument, but I can't change it after test launch if I need 2 threads, not 4.
How can I adjust the number of threads from the my test code?
I think you're looking for this.