]> granicus.if.org Git - python/commitdiff
Fix the failures on cygwin (2006-08-10 fixed the actual locking issue).
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 11 Aug 2006 06:09:41 +0000 (06:09 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 11 Aug 2006 06:09:41 +0000 (06:09 +0000)
The first hunk changes the colon to an ! like other Windows variants.
We need to always wait on the child so the lock gets released and
no other tests fail.  This is the try/finally in the second hunk.

Lib/test/test_mailbox.py
Misc/NEWS

index 45dd118fbe12490fd5a46ec50e43731bd1ca81f0..6cdc441ee2e186cf5e24a94987319d9194083968 100644 (file)
@@ -1,4 +1,5 @@
 import os
+import sys
 import time
 import stat
 import socket
@@ -461,7 +462,7 @@ class TestMaildir(TestMailbox):
 
     def setUp(self):
         TestMailbox.setUp(self)
-        if os.name in ('nt', 'os2'):
+        if os.name in ('nt', 'os2') or sys.platform == 'cygwin':
             self._box.colon = '!'
 
     def test_add_MM(self):
@@ -736,11 +737,13 @@ class _TestMboxMMDF(TestMailbox):
         # In the parent, sleep a bit to give the child time to acquire
         # the lock.
         time.sleep(0.5)
-        self.assertRaises(mailbox.ExternalClashError,
-                          self._box.lock)
+        try:
+            self.assertRaises(mailbox.ExternalClashError,
+                              self._box.lock)
+        finally:
+            # Wait for child to exit.  Locking should now succeed.
+            exited_pid, status = os.waitpid(pid, 0)
 
-        # Wait for child to exit.  Locking should now succeed.
-        exited_pid, status = os.waitpid(pid, 0)
         self._box.lock()
         self._box.unlock()
 
index 25d02942bfa4c98b9b80bbbca8db4498d8bde5c2..f2fc704688a270592cb72d34cbe882444238893b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,6 +58,8 @@ Extension Modules
 Tests
 -----
 
+- test_mailbox should now work on cygwin versions 2006-08-10 and later.
+
 - Bug #1535182: really test the xreadlines() method of bz2 objects.
 
 - test_threading now skips testing alternate thread stack sizes on