How can I parallelize the execution of the unit tests written with pytest? Which tactics of parallelism can I choose from?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
In order to run pytests in parallel you are going to need to install pytest-xdist. Please see the different parallelism tactics listed below, you can use any of those (however I can bet that one of those suits best for your particular case):
You can provide different values for
--dist
(-d
) parameter, which handles the way tests are distributed across workers, see documentation for more information regarding the usage of --dist.NOTE: Once tests are executed the socket_server.py is down. I suggest you running socket server from separate terminal windows for debugging purposes
You can introduce more complicated flows, for instance running tests inside docker containers with have started socket servers kind of "pytest workers" and another docker container which communicates to them and serve as "pytest runner".