Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 54 by
akes...@google.com: StubOutWithMock on a MockAnything
sometimes succeeds, sometimes fails.
http://code.google.com/p/pymox/issues/detail?id=54
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
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings