Combine in parallel

Possible duplicate:
Can a Python parallel test run in parallel, such as a nose?

I have tests that are used with unittest, and they run 1 on 1. I would like to run them in parallel, because I have a lot of waiting, so it will be much faster. Is it possible? I can not find a solution on the Internet, although many ppl talk about it.

+4
source share
2 answers

You can alternatively parallelize through the shell, no? I just tried this command

find -type f -name "_test_*.py" | sed 's/^\.\///; s/\.py$//; s/\//./g;' | xargs -t -P 10 -n 2 python -m unittest 

find lists the test files, so adapt the file name template to your naming convention. sed converts the found paths to valid module names. xargs in this example starts up to 10 processes, each of which starts 2 test modules.

I'm still not sure how to figure out the solution ...

+2
source

You can use nosetests (easy_install nose) to detect and run pyunit tests. The nose has the ability to run them in parallel.

0
source

Source: https://habr.com/ru/post/1381259/


All Articles