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.
import io
import sys
import time
+import errno
import traceback
import warnings
import unittest
if sysconfig.is_python_build():
TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build')
TEMPDIR = os.path.abspath(TEMPDIR)
- if not os.path.exists(TEMPDIR):
+ try:
os.mkdir(TEMPDIR)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
# Define a writable temp dir that will be used as cwd while running
# the tests. The name of the dir includes the pid to allow parallel
Tests
-----
+- Fix possible "file already exists" error when running the tests in parallel.
+
- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
platforms. Patch by Nadeem Vawda.