[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/twisted/tests/test_zeo.py Added code to wait for shutdown when an instance is stopped, to avoid

Jim Fulton jim at zope.com
Thu Dec 22 17:05:08 EST 2005


Log message for revision 40989:
  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/branches/3.2/src/zope/app/twisted/tests/test_zeo.py

-=-
Modified: Zope3/branches/3.2/src/zope/app/twisted/tests/test_zeo.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/twisted/tests/test_zeo.py	2005-12-22 20:18:57 UTC (rev 40988)
+++ Zope3/branches/3.2/src/zope/app/twisted/tests/test_zeo.py	2005-12-22 22:05:06 UTC (rev 40989)
@@ -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