From f031573071e693e9a976d6d37b4cc11cf81f8702 Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Mon, 23 Nov 2009 20:12:57 +0100 Subject: mbox locking: omit dotlock if we don't have the permissions to create it Closes: issue #855269. --- test_archivemail.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test_archivemail.py') diff --git a/test_archivemail.py b/test_archivemail.py index 55c294f..738a5c2 100755 --- a/test_archivemail.py +++ b/test_archivemail.py @@ -120,6 +120,17 @@ class TestMboxDotlock(TestCaseInTempdir): self.mbox._dotlock_unlock() assert(not os.path.isfile(lock)) + def testDotlockingSucceedsUponEACCES(self): + """A dotlock should silently be omitted upon EACCES.""" + archivemail.options.quiet = True + mbox_dir = os.path.dirname(self.mbox_name) + os.chmod(mbox_dir, 0500) + try: + self.mbox._dotlock_lock() + finally: + os.chmod(mbox_dir, 0700) + archivemail.options.quiet = False + class TestMboxPosixLock(TestCaseInTempdir): def setUp(self): super(TestMboxPosixLock, self).setUp() -- cgit v1.2.3