mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Avoid exception if there's a stray directory inside a Maildir folder.
The Maildir specification doesn't seem to say anything about this situation, and it can happen if you're keeping a Maildir mailbox in Subversion (.svn directories) or some similar system. The patch just ignores directories in the cur/, new/, tmp/ folders.
This commit is contained in:
parent
6111ce3667
commit
2b09ef0c6d
2 changed files with 16 additions and 1 deletions
|
@ -686,7 +686,18 @@ class TestMaildir(TestMailbox):
|
|||
folder1_alias = box.get_folder('folder1')
|
||||
self.assert_(folder1_alias._factory is dummy_factory)
|
||||
|
||||
def test_directory_in_folder (self):
|
||||
# Test that mailboxes still work if there's a stray extra directory
|
||||
# in a folder.
|
||||
for i in range(10):
|
||||
self._box.add(mailbox.Message(_sample_message))
|
||||
|
||||
# Create a stray directory
|
||||
os.mkdir(os.path.join(self._path, 'cur', 'stray-dir'))
|
||||
|
||||
# Check that looping still works with the directory present.
|
||||
for msg in self._box:
|
||||
pass
|
||||
|
||||
class _TestMboxMMDF(TestMailbox):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue