[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/twisted/tests/test_zeo.py Merged from 3.2 branch:

Jim Fulton jim at zope.com
Sat Dec 24 11:54:03 EST 2005


Log message for revision 41031:
  Merged from 3.2 branch:
  
  ------------------------------------------------------------------------
    r40989 | jim | 2005-12-22 17:05:06 -0500 (Thu, 22 Dec 2005) | 3 lines
  
  Added code to wait for shutdown when an instance is stopped, to avoid
    possible windows problems, even though we haven't seen any yet.
  

Changed:
  U   Zope3/trunk/src/zope/app/twisted/tests/test_zeo.py

-=-
Modified: Zope3/trunk/src/zope/app/twisted/tests/test_zeo.py
===================================================================
--- Zope3/trunk/src/zope/app/twisted/tests/test_zeo.py	2005-12-24 16:53:53 UTC (rev 41030)
+++ Zope3/trunk/src/zope/app/twisted/tests/test_zeo.py	2005-12-24 16:54:02 UTC (rev 41031)
@@ -216,6 +216,7 @@
             )
         response = connection.getresponse()
         connection.close()
+        self.waittodie()
 
     def main_page(self):
         connection = httplib.HTTPConnection('localhost', self.port)
@@ -241,6 +242,20 @@
                     raise
                 s.close()
 
+    def waittodie(self):
+        addr = 'localhost', self.port
+        for i in range(120):
+            time.sleep(0.25)
+            try:
+                s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+                s.connect(addr)
+                s.close()
+            except socket.error, e:
+                if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
+                    raise
+                s.close()
+                break
+
     url = property(lambda self: 'http://localhost:%d/' % self.port)
     
 def mkfile(dir, name, template, kw):



More information about the Zope3-Checkins mailing list