mirror of
https://github.com/python/cpython.git
synced 2025-09-04 07:51:13 +00:00
#17064: fix sporadic permission errors in test_mailbox on windows.
Patch by Jeremy Kloth.
This commit is contained in:
parent
f78f5b11f6
commit
b3e8384cbe
1 changed files with 8 additions and 8 deletions
|
@ -39,9 +39,9 @@ class TestBase:
|
||||||
def _delete_recursively(self, target):
|
def _delete_recursively(self, target):
|
||||||
# Delete a file or delete a directory recursively
|
# Delete a file or delete a directory recursively
|
||||||
if os.path.isdir(target):
|
if os.path.isdir(target):
|
||||||
shutil.rmtree(target)
|
support.rmtree(target)
|
||||||
elif os.path.exists(target):
|
elif os.path.exists(target):
|
||||||
os.remove(target)
|
support.unlink(target)
|
||||||
|
|
||||||
|
|
||||||
class TestMailbox(TestBase):
|
class TestMailbox(TestBase):
|
||||||
|
@ -2096,9 +2096,9 @@ class MaildirTestCase(unittest.TestCase):
|
||||||
# create a new maildir mailbox to work with:
|
# create a new maildir mailbox to work with:
|
||||||
self._dir = support.TESTFN
|
self._dir = support.TESTFN
|
||||||
if os.path.isdir(self._dir):
|
if os.path.isdir(self._dir):
|
||||||
shutil.rmtree(self._dir)
|
support.rmtree(self._dir)
|
||||||
elif os.path.isfile(self._dir):
|
elif os.path.isfile(self._dir):
|
||||||
os.unlink(self._dir)
|
support.unlink(self._dir)
|
||||||
os.mkdir(self._dir)
|
os.mkdir(self._dir)
|
||||||
os.mkdir(os.path.join(self._dir, "cur"))
|
os.mkdir(os.path.join(self._dir, "cur"))
|
||||||
os.mkdir(os.path.join(self._dir, "tmp"))
|
os.mkdir(os.path.join(self._dir, "tmp"))
|
||||||
|
@ -2108,10 +2108,10 @@ class MaildirTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
list(map(os.unlink, self._msgfiles))
|
list(map(os.unlink, self._msgfiles))
|
||||||
os.rmdir(os.path.join(self._dir, "cur"))
|
support.rmdir(os.path.join(self._dir, "cur"))
|
||||||
os.rmdir(os.path.join(self._dir, "tmp"))
|
support.rmdir(os.path.join(self._dir, "tmp"))
|
||||||
os.rmdir(os.path.join(self._dir, "new"))
|
support.rmdir(os.path.join(self._dir, "new"))
|
||||||
os.rmdir(self._dir)
|
support.rmdir(self._dir)
|
||||||
|
|
||||||
def createMessage(self, dir, mbox=False):
|
def createMessage(self, dir, mbox=False):
|
||||||
t = int(time.time() % 1000000)
|
t = int(time.time() % 1000000)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue