I just discovered something interesting while I was reviewing the django documentation to ensure I was replying correctly in a
pull request review for Ajay on openwisp-controller.
It seems that since at least django 1.10 it has been possible to
run tests in parallel, the docs say: "As long as your tests are properly isolated, you can run them in parallel to gain a speed up on multi-core hardware".
So I tried this on openwisp-controller, let's see how non-parallel and parallel compare on my laptop (which apparently has got an octa-core which means 8 cores):
Non-parallel (classic)
./runtests.py --keepdb
Ran 196 tests in 41.479s
Parallel
./runtests.py --keepdb --parallel
Ran 196 tests in 12.965s
WOW
That's a reduction in time of almost 69%! It's more than 3 times faster.
We should try this on all the modules and find out if there's some test which doesn't run in isolation and fix it, we may be able to drastically reduce the build time of each module, as well as help developers run tests faster!
Let's find out how many cores travis uses for its docker builds. What if it's more than 8 cores? That may result even faster.
Fed