adding a simulation mode
Paul Rubin
no.email at nospam.invalid
Wed Jul 4 13:01:48 EDT 2012
andrea crotti <andrea.crotti.0 at gmail.com> writes:
> copytree(src, dest) becomes:
> if not PRETEND_ONLY:
> copytree(src, dest)
>
> But I don't like it too much because I would have to add a lot of
> garbage around..
I've had good results writing the module under test in the style of a
java applet, i.e. one of its args is a class instance representing the
"outside world", and ALL interaction that you might want to simulate is
done through this object:
def your_prog(parent):
conn = parent.db.make_connection(...)
blah = parent.copytree(...)
Then you make "real" and "mock" versions of the external interface, and
pass in an appropriate instance.
More information about the Python-list
mailing list