1. Matt Chaput
  2. whoosh
  3. Issues
Issue #317 resolved

Temporary file collisions when running tests in parallel

Michał Górny
created an issue

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.

The 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.

Comments (1)

  1. Log in to comment