Mocking `from foo import *` functions

hsoft at hardcoded.net hsoft at hardcoded.net
Sat Jan 10 10:49:20 EST 2009


On Jan 10, 4:19 pm, Rob Williscroft <r... at freenet.co.uk> wrote:
> Note that doing the above *before* any other module imports
> from sender, will be sufficient in *any* case, though it won't
> help if the tested code calls reload( sender ).

Yeah, of course, but most of the time, you want to mock at the *test*
level, (you don't want your mock to affect all the tests in your
module), so you can't just mock the function before you import your
tested module. That is why I created this handy TestCase.



More information about the Python-list mailing list