File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -826,10 +826,10 @@ def resetperms(path):
826
826
cls ._rmtree (path , ignore_errors = ignore_errors )
827
827
# PermissionError is raised on FreeBSD for directories
828
828
except PermissionError :
829
- # bpo-43153: On Windows, calling _rmtree again will
829
+ # bpo-43153: Calling _rmtree again may
830
830
# raise NotADirectoryError and mask the PermissionError.
831
831
# So we must re-raise the current PermissionError.
832
- if _os . name == 'nt' and not _os .path .isdir (path ):
832
+ if not _os .path .isdir (path ):
833
833
if ignore_errors :
834
834
return
835
835
raise
Original file line number Diff line number Diff line change @@ -1460,12 +1460,12 @@ def test_explict_cleanup_ignore_errors(self):
1460
1460
temp_path .exists (),
1461
1461
f"TemporaryDirectory { temp_path !s} exists after cleanup" )
1462
1462
1463
- @unittest .skipUnless (os .name == "nt" , "Only on Windows." )
1464
1463
def test_explicit_cleanup_correct_error (self ):
1465
1464
with tempfile .TemporaryDirectory () as working_dir :
1466
1465
temp_dir = self .do_create (dir = working_dir )
1467
1466
with open (os .path .join (temp_dir .name , "example.txt" ), 'wb' ):
1468
- # Used to raise NotADirectoryError on Windows. See bpo-43153.
1467
+ # Previously raised NotADirectoryError on some OSes
1468
+ # (e.g. WIndows). See bpo-43153.
1469
1469
with self .assertRaises (PermissionError ):
1470
1470
temp_dir .cleanup ()
1471
1471
You can’t perform that action at this time.
0 commit comments