Fix possible "file already exists" error when running the tests in parallel.

This is a perfect example of LBYL going wrong: that code could be executed
by several workers in parallel, and os.mkdir() attempted on the same
path by multiple processes.
2 files changed