From b3e8384cbef09c59f593b518f689462add481679 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Mon, 11 Feb 2013 10:04:26 -0500 Subject: [PATCH] #17064: fix sporadic permission errors in test_mailbox on windows. Patch by Jeremy Kloth. --- Lib/test/test_mailbox.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index c72eb1c949c..7a842929d55 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -39,9 +39,9 @@ def _check_sample(self, msg): def _delete_recursively(self, target): # Delete a file or delete a directory recursively if os.path.isdir(target): - shutil.rmtree(target) + support.rmtree(target) elif os.path.exists(target): - os.remove(target) + support.unlink(target) class TestMailbox(TestBase): @@ -2096,9 +2096,9 @@ def setUp(self): # create a new maildir mailbox to work with: self._dir = support.TESTFN if os.path.isdir(self._dir): - shutil.rmtree(self._dir) + support.rmtree(self._dir) elif os.path.isfile(self._dir): - os.unlink(self._dir) + support.unlink(self._dir) os.mkdir(self._dir) os.mkdir(os.path.join(self._dir, "cur")) os.mkdir(os.path.join(self._dir, "tmp")) @@ -2108,10 +2108,10 @@ def setUp(self): def tearDown(self): list(map(os.unlink, self._msgfiles)) - os.rmdir(os.path.join(self._dir, "cur")) - os.rmdir(os.path.join(self._dir, "tmp")) - os.rmdir(os.path.join(self._dir, "new")) - os.rmdir(self._dir) + support.rmdir(os.path.join(self._dir, "cur")) + support.rmdir(os.path.join(self._dir, "tmp")) + support.rmdir(os.path.join(self._dir, "new")) + support.rmdir(self._dir) def createMessage(self, dir, mbox=False): t = int(time.time() % 1000000)