]> granicus.if.org Git - python/commitdiff
Print more information the next time test_socket throws the wrong exception.
authorJeffrey Yasskin <jyasskin@gmail.com>
Fri, 28 Mar 2008 04:53:10 +0000 (04:53 +0000)
committerJeffrey Yasskin <jyasskin@gmail.com>
Fri, 28 Mar 2008 04:53:10 +0000 (04:53 +0000)
Lib/test/test_socket.py

index 660d85355fa4f85f1203a10a5dd3bbf78e41be82..614096228a882481f39837e19829d0c45eafad5b 100644 (file)
@@ -5,8 +5,9 @@ from test import test_support
 
 import socket
 import select
-import time
 import thread, threading
+import time
+import traceback
 import Queue
 import sys
 import os
@@ -986,10 +987,13 @@ class TCPTimeoutTest(SocketTCPTest):
             except Alarm:
                 pass
             except:
-                self.fail("caught other exception instead of Alarm")
+                self.fail("caught other exception instead of Alarm:"
+                          " %s(%s):\n%s" %
+                          (sys.exc_info()[:2] + (traceback.format_exc(),)))
             else:
                 self.fail("nothing caught")
-            signal.alarm(0)         # shut off alarm
+            finally:
+                signal.alarm(0)         # shut off alarm
         except Alarm:
             self.fail("got Alarm in wrong place")
         finally: