[Zope-dev] zope.sendmail and testing

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue Aug 25 10:19:30 EDT 2009


Adam GROSZER wrote:
> Hello,
> 
> I'd rather use a mailer stub for testing.
> Like the one in zope.sendmail.tests.test_mailer.py
> 
> ...
> class SMTP(object):
> ...
> 
> Something like this can be setup for individual tests with
> 
>   <utility
>       name="mailer-name"
>       provides="zope.sendmail.interfaces.IMailer"
>       factory="your.own.mailerFactory"
>       />
> 
> def mailerFactory():
>     mailer = SMTPMailer()
>     mailer.smtp = SMTP
>     return mailer 

Right, I see. However, what I meant to ask is if there is a way to have 
the registration of such a stub to be more or less automagically done 
during test runs by the zope.sendmail package instead of having to think 
about this over and over again in the packages directly or indirectly 
depending on it.

I *thought* to see a way of getting rid of global data in 
zope.testing.cleanup, and I wonder if we could think of a way to set up 
global data in a similar manner

regards,
jw




More information about the Zope-Dev mailing list