I looked at this in winpdb, and it is weird.
sock.rev() raises socket.timeout (normal, it seems). This is caught by the try/except of cmd_query(), which then raises it again. So we go up one level, in cursor.py:
except StandardError, e:
raise errors.InterfaceError( "Failed executing the operation; %s" % e)
which raises InterfaceError, as the unit test expects.
This exception is then caught inside failUnlessRaises(), as expected, so we come to the "return"
def failUnlessRaises(self, excClass, callableObj, *args, **kwargs):
<cut>
try: callableObj(*args, **kwargs)
except excClass:
return # <<< we come here
but, somehow it seems that the exception still comes out of this, as the debugger says that self.assertRaises(errors.InterfaceError, c.execute, "SELECT SLEEP(%d)" % (config['connection_timeout']+4))
produces an exception.
Weird: the exception was apparently caught but it seems to come out.
I looked at this in winpdb, and it is weird. InterfaceError(
"Failed executing the operation; %s" % e)
sock.rev() raises socket.timeout (normal, it seems). This is caught by the try/except of cmd_query(), which then raises it again. So we go up one level, in cursor.py:
except StandardError, e:
raise errors.
which raises InterfaceError, as the unit test expects.
This exception is then caught inside failUnlessRaises(), as expected, so we come to the "return"
def failUnlessRaise s(self, excClass, callableObj, *args, **kwargs):
callableOb j(*args, **kwargs)
<cut>
try:
except excClass:
return # <<< we come here
but, somehow it seems that the exception still comes out of this, as the debugger says that
self.assertRai ses(errors. InterfaceError,
c. execute, "SELECT SLEEP(%d)" % (config[ 'connection_ timeout' ]+4))
produces an exception.
Weird: the exception was apparently caught but it seems to come out.