Use try/except when creating the temporary test directory, to avoid a race condition when run in parallel.
@@ -5,6 +5,8 @@ import shutil
@pytest.fixture(autouse=True, scope='session')
def test_session_wrapper():
# Create and enter a temporary build directory.
- if not os.path.isdir('pytest_tmp'):
+ try:
os.mkdir('pytest_tmp')
+ except FileExistsError:
+ pass
os.chdir('pytest_tmp')
