Samudranil Roy
Samudranil Roy

Reputation: 221

Parallel testing in py.test

Is there any way to use parallel/ concurrent testing in py test? If not can any one please recommend good solution to do parallel testing of several test cases in python 3?

Upvotes: 2

Views: 1353

Answers (1)

Samuel Dion-Girardeau
Samuel Dion-Girardeau

Reputation: 3180

pytest actually has plugin called pytest-xdist, which allows you to parallelize test runs.

Once you install that plugin, you can run the tests using multiple processes, for instance on 4 CPUs:

pytest -n 4

You might need to adapt the tests for them to be parallelization-friendly, but if they are already well isolated, this should just work!

Upvotes: 1

Related Questions