From: Pekka L. <pe...@ik...> - 2007-07-25 21:45:09
|
2007/7/25, Alan Kennedy <jyt...@xh...>: > [Pekka] > > I run socket and select unit test on my Linux machine and got some errors. > > >> From socket tests I got normally 44 errors but sometimes few less. All > > > Let me know if some more information is needed, I should be running > > these tests differently, etc. > > Try commenting out the "TCPClientTimeoutTest" class in the test_main() > function at the bottom of the test_socket.py file. > > It not doing what I originally expected when I wrote it, and may be > disturbing the rest of the tests, by colliding with the sequence of bind > calls to the server socket. Tried that but still got 43 errors most of the time and sometimes 32 or 35. Errors seem to be same as before and the error message is still "error: (98, 'Address already in use')". Btw, when I looked at these tests I noticed following code where the message in else branch looks pretty weird. Shouldn't it say "Send on unconnected socket didn't raise exception" since isn't else branch executed when there's no exception? Having "except Exception, x" is also probably not needed here since uncaught exceptions are caught by unittest runner anyway. There were also some places where checking only exception type is enough and assertRaises could be used instead of more verbose try/except/else. try: self.s.send(MSG) except socket.error, se: self.failUnlessEqual(se[0], errno.ENOTCONN) except Exception, x: self.fail("Send on unconnected socket raised wrong exception: %s" % x) else: self.fail("Send on unconnected socket raised exception") Cheers, .peke |