On a related note, Michael Foord's `mock.py` was recently added to the python stdlib.<p><a href="http://www.voidspace.org.uk/python/mock/mock.html" rel="nofollow">http://www.voidspace.org.uk/python/mock/mock.html</a>
I can't see how this is different from mock.py. Mock can also do temporary patching:<p>with patch('path.to.object') as my_mock:
my_mock.method.return_value = ...<p>also you can patch a module/class with a function.
I'd avoid monkey patching, it can confuse the programmer as to which module is being used. In a small program it's not a big deal but in large systems it can become an issue.