bpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 (GH-17958)
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 @@
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)