Temporary file collisions when running tests in parallel
We're building Whoosh in Gentoo for multiple Python versions in parallel. We'd like to run tests in parallel as well but currently that can result in test failures due to file collisions.
TempDir object uses a constant
tmp temporary directory and appends either a semi-random integer to it, or a constant passed
basename. While collisions with the former are quite improbable, the latter guarantees them.
An easy way of reproducing the issue is to run:
for a in $(seq 10); do nosetests tests/test_tables.py & :; done
You'd notice that all the runs are using the same test file and failures start happening.
I've suggested a fix through using truly unique directory (
mkdtemp()) in pull request #38.