diff --git a/changelog/5524.bugfix.rst b/changelog/5524.bugfix.rst new file mode 100644 index 00000000000..3b94ca853a6 --- /dev/null +++ b/changelog/5524.bugfix.rst @@ -0,0 +1 @@ +Fixed rare race condition error when creating the ``basetemp`` directory. diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index ecc38eb0f4d..956dbaea0da 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -33,7 +33,7 @@ def ensure_reset_dir(path): """ if path.exists(): rmtree(path, force=True) - path.mkdir() + path.mkdir(exist_ok=True) def rmtree(path, force=False):