[Python-Dev] 2.5.2 release coming up

ocean ocean at m2.ccsnet.ne.jp
Thu Jan 24 12:49:44 CET 2008


> But on windows, ":" is special letter after drive letter. (ex:
> "C:/Winnt/foo/bar")
> So I imagine open() or something converts ":" to  "!" (valid character as
> file name).

Sorry, I lied. :-(

open() didn't change ":", test_mailbox.py (TestMaildir.setUp) changed
self._box.colon to "!"

Otherwise, newly created mail box in test_consistent_factory 's "colon" is
":".
This mismatch causes error.

Following patch solves error, but I don't know if this is good solution.

Index: Lib/test/test_mailbox.py
===================================================================
--- Lib/test/test_mailbox.py (revision 60233)
+++ Lib/test/test_mailbox.py (working copy)
@@ -458,12 +458,11 @@

 class TestMaildir(TestMailbox):

-    _factory = lambda self, path, factory=None: mailbox.Maildir(path,
factory)
-
-    def setUp(self):
-        TestMailbox.setUp(self)
+    def _factory(self, path, factory=None):
+        box = mailbox.Maildir(path, factory)
         if os.name in ('nt', 'os2') or sys.platform == 'cygwin':
-            self._box.colon = '!'
+            box.colon = '!'
+        return box

     def test_add_MM(self):
         # Add a MaildirMessage instance
@@ -518,7 +517,7 @@
         # Create new mailbox with
         class FakeMessage(mailbox.MaildirMessage):
             pass
-        box = mailbox.Maildir(self._path, factory=FakeMessage)
+        box = self._factory(self._path, factory=FakeMessage)
         msg2 = box.get_message(key)
         self.assert_(isinstance(msg2, FakeMessage))




More information about the Python-Dev mailing list