andrea crotti <andrea.crott...@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.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to