Rev 2832: Remove some more noise from test suite. in file:///v/home/vila/src/cleanup/http.server/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Sep 19 02:44:39 BST 2007


At file:///v/home/vila/src/cleanup/http.server/

------------------------------------------------------------
revno: 2832
revision-id: v.ladeuil+lp at free.fr-20070919014438-w65bobnp7lxa2ti4
parent: pqm at pqm.ubuntu.com-20070918045733-es6jch43pxvogvhj
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: http.server
timestamp: Wed 2007-09-19 03:44:38 +0200
message:
  Remove some more noise from test suite.
  
  * bzrlib/tests/HttpServer.py:
  (TestingHTTPRequestHandler.handle_one_request): Catch socket
  closing by client without polluting test suite.
modified:
  bzrlib/tests/HttpServer.py     httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
-------------- next part --------------
=== modified file 'bzrlib/tests/HttpServer.py'
--- a/bzrlib/tests/HttpServer.py	2007-09-17 15:48:23 +0000
+++ b/bzrlib/tests/HttpServer.py	2007-09-19 01:44:38 +0000
@@ -60,10 +60,30 @@
     def handle_one_request(self):
         """Handle a single HTTP request.
 
+        We catch all socket errors occurring when the client close the
+        connection early to avoid polluting the test results.
+        """
+        try:
+            self._handle_one_request()
+        except socket.error, e:
+            if (len(e.args) > 0
+                and e.args[0] in (errno.EPIPE, errno.ECONNRESET,
+                                  errno.ECONNABORTED,)):
+                self.close_connection = 1
+                pass
+            else:
+                raise
+
+    def _handle_one_request(self):
+        """
+        Request handling as defined in the base class.
+
         You normally don't need to override this method; see the class
         __doc__ string for information on how to handle specific HTTP
         commands such as GET and POST.
 
+        On some platforms, notably OS X, a lot of EAGAIN (ressource temporary
+        unavailable) occur. We retry silently at most 10 times.
         """
         for i in xrange(1,11): # Don't try more than 10 times
             try:



More information about the bazaar-commits mailing list