diff options
author | Collin Winter <collinw@gmail.com> | 2007-03-10 14:33:32 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-03-10 14:33:32 (GMT) |
commit | 3351aa7dd509c72335fd37a7eae79e62ba48f773 (patch) | |
tree | 37a8fa7935681d4f7cf28247f0d3d0f9a76c67e8 | |
parent | 74780961483ef3ec92b8a8ea4c1cf46125e75a4d (diff) | |
download | cpython-3351aa7dd509c72335fd37a7eae79e62ba48f773.zip cpython-3351aa7dd509c72335fd37a7eae79e62ba48f773.tar.gz cpython-3351aa7dd509c72335fd37a7eae79e62ba48f773.tar.bz2 |
Convert an assert to a raise so it works even in the presence of -O.
-rw-r--r-- | Lib/test/test_socketserver.py | 6 |
1 files 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" |