[Python-checkins] r54260 - python/trunk/Lib/test/test_socketserver.py

collin.winter python-checkins at python.org
Sat Mar 10 15:33:36 CET 2007


Author: collin.winter
Date: Sat Mar 10 15:33:32 2007
New Revision: 54260

Modified:
   python/trunk/Lib/test/test_socketserver.py
Log:
Convert an assert to a raise so it works even in the presence of -O.

Modified: python/trunk/Lib/test/test_socketserver.py
==============================================================================
--- python/trunk/Lib/test/test_socketserver.py	(original)
+++ python/trunk/Lib/test/test_socketserver.py	Sat Mar 10 15:33:32 2007
@@ -81,10 +81,12 @@
         svr = svrcls(self.__addr, self.__hdlrcls)
         # pull the address out of the server in case it changed
         # this can happen if another process is using the port
-        addr = getattr(svr, 'server_address')
+        addr = svr.server_address
         if addr:
             self.__addr = addr
-            assert self.__addr == svr.socket.getsockname()
+            if self.__addr != svr.socket.getsockname():
+                raise RuntimeError('server_address was %s, expected %s' %
+                                       (self.__addr, svr.socket.getsockname()))
         if verbose: print "thread: serving three times"
         svr.serve_a_few()
         if verbose: print "thread: done"


More information about the Python-checkins mailing list