Re: unit testing a routine that sends mail

2010-02-19 Thread Bruno Desthuilliers
commander_coder a écrit : Hello, I have a routine that sends an email (this is how a Django view notifies me that an event has happened). I want to unit test that routine. http://docs.djangoproject.com/en/dev/topics/email/#e-mail-backends Or if you're stuck with 1.x < 1.2a, you could just

Re: unit testing a routine that sends mail

2010-02-18 Thread Phlip
commander_coder wrote: > I have a routine that sends an email (this is how a Django view > notifies me that an event has happened).  I want to unit test that > routine. Are you opening SMTP and POP3 sockets?? If you are not developing that layer itself, just use Django's built- in mock system. H

Re: unit testing a routine that sends mail

2010-02-18 Thread commander_coder
Bruno, I talked to someone who explained to me how what you said gives a way around my difficulty. Please ignore the other reply. I'll do what you said. Thank you; I appreciate your help. Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: unit testing a routine that sends mail

2010-02-18 Thread commander_coder
On Feb 18, 10:27 am, Bruno Desthuilliers wrote: > you could just mock the send_mail > function to test that your app does send the appropriate mail - which is > what you really want to know. That's essentially what I think I am doing. I need to send a relatively complex email, multipart, with b

Re: unit testing a routine that sends mail

2010-02-18 Thread commander_coder
On Feb 18, 9:55 am, Roy Smith wrote: > Just a wild guess here, but maybe there's some DNS server which > round-robins three address records for some hostname you're using, one of > which is bogus. > > I've seen that before, and this smells like the right symptoms. Everything happens on my laptop,

Re: unit testing a routine that sends mail

2010-02-18 Thread Roy Smith
In article , commander_coder wrote: > The real puzzler for me is that the test reliably fails every third > time. For instance, if I try it six times then it succeeds the first, > second, fourth, and fifth times. I have to say that I cannot > understand this at all but it certainly makes the