On Tue, Nov 21, 2006 at 05:00:32PM -0800, Tom Plunket wrote:
Bruno Desthuilliers wrote:
I've got a bunch of code that runs under a bunch of unit tests. It'd
be really handy if when testing I could supply replacement
functionality to verify that the right things get called without those
things actually getting called, since frequently those calls take a
long time to execute and do things that, well, I don't really want to
do.
Congratulation, you just rediscovered the MockObject.
How do I rediscover something that I'm explicitly implementing? I had
set out specifically to mock an API, there was no rediscovery going
on.
That does allow me to discover via Google the Python Mock Module,
though, which may well do what I want:
from TestedModule import *
my_win32file = Mock({
'CopyFile': 'CopyFile called'
}
win32file = my_win32file
...perhaps.
I'm just a bit loathe to download and install more stuff when
something simpler appears to be near-at-hand. ...especially
considering the page describing this module doesn't offer any download
links! http://python-mock.sourceforge.net/
How about mini-mock:
http://blog.ianbicking.org/minimock.html
-tom!
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list