New issue 16 by alan.franzoni: Mox sometimes swallows unexpected method
calls
http://code.google.com/p/pymox/issues/detail?id=16
Tested againt latest trunk (rev. 38)
I've encountered one bad issue in mock: it can sometimes happen that an
error is silently "swallowed" by the mocking framework. (see the attached
file).
Basically, what happens is that MockMethod just raises an exception
immediately if the method is called unexpectedly. But if the exception is
trapped in the caller code, e.g. something like
try:
mockobject.callUnknownMethod()
except:
log.error.something(....)
the exception is swallowed and the test passes without error.
Of course, the try...except in the caller code might be perfectly legit
(because there might be the absolute need the func not to throw at
anytime), but it is aimed at catching exceptions which are raised by the
function call itself, not by the fact that the function should not be
called.
I do not provide a patch since I think this would need a bit of "rework",
e.g. a MockMethod raising such error should trigger a change in the
"global" Mox object state which should then be re-raised when calling
VerifyAll().
Attachments:
mox_sync_exc.py 540 bytes
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
I'll see if I can get around to adding this over my holiday break.