What steps will reproduce the problem?
1. Create a source file mox_restub.py, with the following contents:
import mox
class MyClass(object):
def MyFunction():
pass
m=mox.Mox()
print MyClass.MyFunction # <unbound method MyClass.MyFunction>
m.StubOutWithMock(MyClass, 'MyFunction')
print MyClass.MyFunction # <MockAnything instance at 139942970002032>
m.StubOutWithMock(MyClass, 'MyFunction')
print MyClass.MyFunction # <MockAnything instance at 139942970064208>
m.StubOutWithMock(MyClass, 'MyFunction')
# TypeError: Cannot Mock a MockAnything! Did you
# remember to call UnsetStubs in your previous
# test?
2. run python ./mox_restub.py
*****
What is the expected output? What do you see instead?
I expect an exception to be thrown at the second call to StubOutWithMock, since
MyClass.MyFunction is already a MockAnything that has not been unset with
UnsetStubs.
Instead, the second call to StubOutWithMock silently succeeds, but the third
call fails.
*****
What version of the product are you using? On what operating system?
mox: python-mox 0.5.3-1ubuntu5
os: Ubuntu 12.04.1 LTS
Original issue reported on code.google.com by akes...@google.com on 15 Feb 2013 at 6:42
Original issue reported on code.google.com by
akes...@google.com
on 15 Feb 2013 at 6:42