From 3351aa7dd509c72335fd37a7eae79e62ba48f773 Mon Sep 17 00:00:00 2001 From: Collin Winter Date: Sat, 10 Mar 2007 14:33:32 +0000 Subject: Convert an assert to a raise so it works even in the presence of -O. --- Lib/test/test_socketserver.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 6232175..9a67a35 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -81,10 +81,12 @@ class ServerThread(threading.Thread): 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" -- cgit v0.12