diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index a50ecd168..577c929bd 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -268,9 +268,7 @@ def maybe_delete_a_numbered_dir(path: Path) -> None: lock_path = None try: lock_path = create_cleanup_lock(path) - with tempfile.TemporaryDirectory( - prefix="garbage-", dir=path.parent - ) as garbage: + with tempfile.TemporaryDirectory(prefix="garbage-", dir=path.parent) as garbage: path.replace(garbage) except OSError: # known races: