Make tests work on multiple cores.

To run tests on many threads, invoke pytest with -n 2 (for 2 threads) argument.
For example: `py.test -q -n 4`.