-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the test and fix maybe_delete_a_numbered_dir for long paths
Related to #6755
- Loading branch information
1 parent
f7ad71d
commit 163d36e
Showing
2 changed files
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,17 +94,18 @@ def renamed_failed(*args): | |
|
||
def test_long_path_during_cleanup(tmp_path): | ||
"""Ensure that deleting long path works (particularly on Windows (#6775)).""" | ||
path = tmp_path / ("a" * 250) | ||
path = (tmp_path / ("a" * 250)).resolve() | ||
if sys.platform == "win32": | ||
dirname = path.resolve() | ||
# make sure that the full path is > 260 characters without any | ||
# component being over 260 characters | ||
assert len(str(path)) > 260 | ||
dirname = "\\\\?\\" + str(path) | ||
os.mkdir(dirname) | ||
lock_path = get_lock_path(path) | ||
extended_path = "\\\\?\\" + str(path) | ||
else: | ||
extended_path = str(path) | ||
os.mkdir(extended_path) | ||
assert os.path.isdir(extended_path) | ||
maybe_delete_a_numbered_dir(path) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
RonnyPfannschmidt
Member
|
||
assert not lock_path.is_file() | ||
assert not os.path.isdir(extended_path) | ||
|
||
|
||
def test_get_extended_length_path_str(): | ||
|
This ensures that
maybe_delete_a_numbered_dir
can delete a non-extended long path.