Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b3e8384

Browse files
committed
#17064: fix sporadic permission errors in test_mailbox on windows.
Patch by Jeremy Kloth.
1 parent f78f5b1 commit b3e8384

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/test/test_mailbox.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def _check_sample(self, msg):
3939
def _delete_recursively(self, target):
4040
# Delete a file or delete a directory recursively
4141
if os.path.isdir(target):
42-
shutil.rmtree(target)
42+
support.rmtree(target)
4343
elif os.path.exists(target):
44-
os.remove(target)
44+
support.unlink(target)
4545

4646

4747
class TestMailbox(TestBase):
@@ -2096,9 +2096,9 @@ def setUp(self):
20962096
# create a new maildir mailbox to work with:
20972097
self._dir = support.TESTFN
20982098
if os.path.isdir(self._dir):
2099-
shutil.rmtree(self._dir)
2099+
support.rmtree(self._dir)
21002100
elif os.path.isfile(self._dir):
2101-
os.unlink(self._dir)
2101+
support.unlink(self._dir)
21022102
os.mkdir(self._dir)
21032103
os.mkdir(os.path.join(self._dir, "cur"))
21042104
os.mkdir(os.path.join(self._dir, "tmp"))
@@ -2108,10 +2108,10 @@ def setUp(self):
21082108

21092109
def tearDown(self):
21102110
list(map(os.unlink, self._msgfiles))
2111-
os.rmdir(os.path.join(self._dir, "cur"))
2112-
os.rmdir(os.path.join(self._dir, "tmp"))
2113-
os.rmdir(os.path.join(self._dir, "new"))
2114-
os.rmdir(self._dir)
2111+
support.rmdir(os.path.join(self._dir, "cur"))
2112+
support.rmdir(os.path.join(self._dir, "tmp"))
2113+
support.rmdir(os.path.join(self._dir, "new"))
2114+
support.rmdir(self._dir)
21152115

21162116
def createMessage(self, dir, mbox=False):
21172117
t = int(time.time() % 1000000)

0 commit comments

Comments
 (0)