summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_smtplib.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-03-21 01:55:14 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-03-21 01:55:14 (GMT)
commita686ed7d10076319007e50978f68079886a7fd4a (patch)
tree311c9fa48339f371867af3ef65c520326af0f903 /Lib/test/test_smtplib.py
parent74b24047e3ac3000564a6e0d699bf5a5eaaddf9d (diff)
parent853c0f9d601ca23727e1519d9b2ee82ccb45989f (diff)
downloadcpython-a686ed7d10076319007e50978f68079886a7fd4a.zip
cpython-a686ed7d10076319007e50978f68079886a7fd4a.tar.gz
cpython-a686ed7d10076319007e50978f68079886a7fd4a.tar.bz2
Merge: #5713: fix timing issue in smtplib tests.
Diffstat (limited to 'Lib/test/test_smtplib.py')
-rw-r--r--Lib/test/test_smtplib.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index c0d9dbd..35bd22e 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -848,6 +848,7 @@ class SMTPSimTests(unittest.TestCase):
# 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')
@@ -856,6 +857,7 @@ class SMTPSimTests(unittest.TestCase):
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')
@@ -872,6 +874,7 @@ class SMTPSimTests(unittest.TestCase):
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@foo.org', ['Sally@foo.org'], 'test message')
self.assertIsNone(smtp.sock)