Skip to content

Commit b658bfc

Browse files
Remove windows check
1 parent b9f074f commit b658bfc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/tempfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,10 @@ def resetperms(path):
826826
cls._rmtree(path, ignore_errors=ignore_errors)
827827
# PermissionError is raised on FreeBSD for directories
828828
except PermissionError:
829-
# bpo-43153: On Windows, calling _rmtree again will
829+
# bpo-43153: Calling _rmtree again may
830830
# raise NotADirectoryError and mask the PermissionError.
831831
# 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):
833833
if ignore_errors:
834834
return
835835
raise

Lib/test/test_tempfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,12 +1460,12 @@ def test_explict_cleanup_ignore_errors(self):
14601460
temp_path.exists(),
14611461
f"TemporaryDirectory {temp_path!s} exists after cleanup")
14621462

1463-
@unittest.skipUnless(os.name == "nt", "Only on Windows.")
14641463
def test_explicit_cleanup_correct_error(self):
14651464
with tempfile.TemporaryDirectory() as working_dir:
14661465
temp_dir = self.do_create(dir=working_dir)
14671466
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.
14691469
with self.assertRaises(PermissionError):
14701470
temp_dir.cleanup()
14711471

0 commit comments

Comments
 (0)