Rev 5561: (vila) Catch spurious and bogus ssl TypeError exceptions. (Vincent Ladeuil) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Dec 7 17:36:50 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5561 [merge]
revision-id: pqm at pqm.ubuntu.com-20101207173648-syzxgasx6un7em9l
parent: pqm at pqm.ubuntu.com-20101206082400-6g52pmiz8tqwq3me
parent: v.ladeuil+lp at free.fr-20101207170125-d50haohq7fg7obw7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-12-07 17:36:48 +0000
message:
  (vila) Catch spurious and bogus ssl TypeError exceptions. (Vincent Ladeuil)
modified:
  bzrlib/tests/https_server.py   https_server.py-20071121173708-aj8zczi0ziwbwz21-1
  bzrlib/tests/test_server.py    test_server.py-20100209163834-im1ozfuenfmqaa2m-1
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/tests/https_server.py'
--- a/bzrlib/tests/https_server.py	2010-07-01 06:40:14 +0000
+++ b/bzrlib/tests/https_server.py	2010-12-07 16:18:50 +0000
@@ -17,6 +17,7 @@
 """HTTPS test server, available when ssl python module is available"""
 
 import ssl
+import sys
 
 from bzrlib.tests import (
     http_server,
@@ -51,6 +52,17 @@
             request.do_handshake()
         return serving
 
+    def ignored_exceptions_during_shutdown(self, e):
+        if (sys.version < (2, 7) and isinstance(e, TypeError)
+            and e.args[0] == "'member_descriptor' object is not callable"):
+            # Fixed in python-2.7 (and some Ubuntu 2.6) there is a bug where
+            # the ssl socket fail to raise a socket.error when trying to read
+            # from a closed socket. This is rarely observed in practice but
+            # still make valid selftest runs fail if not caught.
+            return True
+        base = test_server.TestingTCPServerMixin
+        return base.ignored_exceptions_during_shutdown(self, e)
+
 
 class TestingHTTPSServer(TestingHTTPSServerMixin,
                          http_server.TestingHTTPServer):

=== modified file 'bzrlib/tests/test_server.py'
--- a/bzrlib/tests/test_server.py	2010-08-31 08:24:17 +0000
+++ b/bzrlib/tests/test_server.py	2010-12-07 17:01:25 +0000
@@ -531,8 +531,8 @@
         # Update the client description
         self.clients.pop()
         self.clients.append((request, client_address, t))
-        # Propagate the exception handler since we must use the same one for
-        # connections running in their own threads than TestingTCPServer.
+        # Propagate the exception handler since we must use the same one as
+        # TestingTCPServer for connections running in their own threads.
         t.set_ignored_exceptions(self.ignored_exceptions)
         t.start()
         started.wait()
@@ -634,7 +634,7 @@
                 # server thread, it may happen that it's not blocked or even
                 # not started.
                 pass
-            # We start shutting down the client while the server itself is
+            # We start shutting down the clients while the server itself is
             # shutting down.
             self.server.stop_client_connections()
             # Now we wait for the thread running self.server.serve() to finish

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2010-12-03 11:16:25 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2010-12-07 16:27:49 +0000
@@ -61,6 +61,9 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* Catch exceptions related to bug #637821 during test cleanup to avoid
+  spurious failures. (Vincent Ladeuil, #686008).
+
 * ``TestDebuntuExpansions`` was escaping the test isolation by calling the
   wrong base class ``setUp``. (Vincent Ladeuil, #684622)
 




More information about the bazaar-commits mailing list