summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_smtplib.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-01-14 07:49:59 (GMT)
committerVictor Stinner <vstinner@python.org>2020-01-14 07:49:59 (GMT)
commit62e3973395fb9fab2eb8f651bcd0fea4e695e1cf (patch)
tree63c213ab1284ed6e7b28f858e7fecac4593f6246 /Lib/test/test_smtplib.py
parent2de064e6305008d16571a21e5f0c178e62e81f27 (diff)
downloadcpython-62e3973395fb9fab2eb8f651bcd0fea4e695e1cf.zip
cpython-62e3973395fb9fab2eb8f651bcd0fea4e695e1cf.tar.gz
cpython-62e3973395fb9fab2eb8f651bcd0fea4e695e1cf.tar.bz2
bpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 (GH-17958)
Diffstat (limited to 'Lib/test/test_smtplib.py')
-rw-r--r--Lib/test/test_smtplib.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index faf013a..cc5c4b1 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -122,6 +122,11 @@ class GeneralTests(unittest.TestCase):
self.assertIsNone(smtp.sock.gettimeout())
smtp.close()
+ def testTimeoutZero(self):
+ mock_socket.reply_with(b"220 Hola mundo")
+ with self.assertRaises(ValueError):
+ smtplib.SMTP(HOST, self.port, timeout=0)
+
def testTimeoutValue(self):
mock_socket.reply_with(b"220 Hola mundo")
smtp = smtplib.SMTP(HOST, self.port, timeout=30)