Re: Mocking `from foo import *` functions

2009-01-12 Thread Silfheed
Brilliant, I love it. Thanks a million, guys. -- http://mail.python.org/mailman/listinfo/python-list

Re: Mocking `from foo import *` functions

2009-01-10 Thread hsoft
On Jan 10, 4:19 pm, Rob Williscroft 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,

Re: Mocking `from foo import *` functions

2009-01-10 Thread Rob Williscroft
wrote in news:a9ed10ff-d907-46f0-8c6a- c3d95579a...@k1g2000prb.googlegroups.com in comp.lang.python: > To answer to Rob: yeah, sure that would work, but I always thought Just to note: you're answering a question about testing, but I answered how to alter the alerter module *for* testing. given

Re: Mocking `from foo import *` functions

2009-01-09 Thread hsoft
On Jan 10, 4:21 am, Silfheed wrote: > So I'm in the current testing situation: > > sender.py: > - > def sendEmails(): >    return "I send emails" > > alerter.py: > - > from sender import * > def DoStuffAndSendEmails(): >   doStuff() >   sendEmails() > > I'm trying to write

Re: Mocking `from foo import *` functions

2009-01-09 Thread Rob Williscroft
Silfheed wrote in news:c73b304b-f601-4bb5-89c1-3ee667eeb7d9 @l37g2000vba.googlegroups.com in comp.lang.python: > So I'm in the current testing situation: > > sender.py: > - > def sendEmails(): >return "I send emails" > > alerter.py: > - > from sender import * > def Do

Re: Mocking `from foo import *` functions

2009-01-09 Thread MRAB
Silfheed wrote: So I'm in the current testing situation: sender.py: - def sendEmails(): return "I send emails" alerter.py: - from sender import * def DoStuffAndSendEmails(): doStuff() sendEmails() I'm trying to write a test fn that will test DoStuffAndSendEmails(