diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2007-07-14 22:06:30 +0000 |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2007-07-14 22:06:30 +0000 |
commit | 6ecd4a0535580bc12b062a39ab8288b18e87daad (patch) | |
tree | 7dbf107146563ac3ae60fae97e1830f7b44c794a /Lib/test/test_mailbox.py | |
parent | 0336870720fb6630add0771e50e174273f7a8711 (diff) | |
download | cpython-git-6ecd4a0535580bc12b062a39ab8288b18e87daad.tar.gz |
[Backport of r56382]
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.
Diffstat (limited to 'Lib/test/test_mailbox.py')
-rw-r--r-- | Lib/test/test_mailbox.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 18e6b67742..57e44f436c 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -685,7 +685,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): |