[Python-checkins] cpython (3.2): #5713: fix timing issue in smtplib tests.

r.david.murray python-checkins at python.org
Thu Mar 21 02:56:34 CET 2013


http://hg.python.org/cpython/rev/fbf54209de75
changeset:   82855:fbf54209de75
branch:      3.2
parent:      82852:72056f06632f
user:        R David Murray <rdmurray at bitdance.com>
date:        Wed Mar 20 21:54:05 2013 -0400
summary:
  #5713: fix timing issue in smtplib tests.

files:
  Lib/test/test_smtplib.py |  3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -789,6 +789,7 @@
     # Issue 5713: make sure close, not rset, is called if we get a 421 error
     def test_421_from_mail_cmd(self):
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+        smtp.noop()
         self.serv._SMTPchannel.mail_response = '421 closing connection'
         with self.assertRaises(smtplib.SMTPSenderRefused):
             smtp.sendmail('John', 'Sally', 'test message')
@@ -797,6 +798,7 @@
 
     def test_421_from_rcpt_cmd(self):
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+        smtp.noop()
         self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing']
         with self.assertRaises(smtplib.SMTPRecipientsRefused) as r:
             smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message')
@@ -813,6 +815,7 @@
                     super().found_terminator()
         self.serv.channel_class = MySimSMTPChannel
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+        smtp.noop()
         with self.assertRaises(smtplib.SMTPDataError):
             smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message')
         self.assertIsNone(smtp.sock)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list