[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/twisted/tests/test_inputbuffering.py Added code to make the client wait for a server to shutdown (I hope).

Jim Fulton jim at zope.com
Thu Dec 22 15:19:02 EST 2005


Log message for revision 40988:
  Added code to make the client wait for a server to shutdown (I hope).
  Maybe this will fix the tear-down failure we're seeing on windows.
  

Changed:
  U   Zope3/branches/3.2/src/zope/app/twisted/tests/test_inputbuffering.py

-=-
Modified: Zope3/branches/3.2/src/zope/app/twisted/tests/test_inputbuffering.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/twisted/tests/test_inputbuffering.py	2005-12-22 19:05:58 UTC (rev 40987)
+++ Zope3/branches/3.2/src/zope/app/twisted/tests/test_inputbuffering.py	2005-12-22 20:18:57 UTC (rev 40988)
@@ -191,6 +191,7 @@
             )
         response = connection.getresponse()
         connection.close()
+        self.waittodie()
 
     def main_page(self):
         connection = httplib.HTTPConnection('localhost', self.port)
@@ -216,6 +217,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