@@ -964,11 +964,13 @@ def tearDown(self):
964964
965965 def testBasic (self ):
966966 # smoke test
967- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
967+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
968+ timeout = support .LOOPBACK_TIMEOUT )
968969 smtp .quit ()
969970
970971 def testEHLO (self ):
971- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
972+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
973+ timeout = support .LOOPBACK_TIMEOUT )
972974
973975 # no features should be present before the EHLO
974976 self .assertEqual (smtp .esmtp_features , {})
@@ -989,7 +991,8 @@ def testEHLO(self):
989991 smtp .quit ()
990992
991993 def testVRFY (self ):
992- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
994+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
995+ timeout = support .LOOPBACK_TIMEOUT )
993996
994997 for addr_spec , name in sim_users .items ():
995998 expected_known = (250 , bytes ('%s %s' %
@@ -1003,7 +1006,8 @@ def testVRFY(self):
10031006 smtp .quit ()
10041007
10051008 def testEXPN (self ):
1006- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1009+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1010+ timeout = support .LOOPBACK_TIMEOUT )
10071011
10081012 for listname , members in sim_lists .items ():
10091013 users = []
@@ -1019,30 +1023,34 @@ def testEXPN(self):
10191023
10201024 def testAUTH_PLAIN (self ):
10211025 self .serv .add_feature ("AUTH PLAIN" )
1022- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1026+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1027+ timeout = support .LOOPBACK_TIMEOUT )
10231028 resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
10241029 self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
10251030 smtp .close ()
10261031
10271032 def testAUTH_LOGIN (self ):
10281033 self .serv .add_feature ("AUTH LOGIN" )
1029- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1034+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1035+ timeout = support .LOOPBACK_TIMEOUT )
10301036 resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
10311037 self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
10321038 smtp .close ()
10331039
10341040 @requires_hashdigest ('md5' )
10351041 def testAUTH_CRAM_MD5 (self ):
10361042 self .serv .add_feature ("AUTH CRAM-MD5" )
1037- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1043+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1044+ timeout = support .LOOPBACK_TIMEOUT )
10381045 resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
10391046 self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
10401047 smtp .close ()
10411048
10421049 def testAUTH_multiple (self ):
10431050 # Test that multiple authentication methods are tried.
10441051 self .serv .add_feature ("AUTH BOGUS PLAIN LOGIN CRAM-MD5" )
1045- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1052+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1053+ timeout = support .LOOPBACK_TIMEOUT )
10461054 resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
10471055 self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
10481056 smtp .close ()
@@ -1060,7 +1068,8 @@ def test_auth_function(self):
10601068 for mechanism in supported :
10611069 with self .subTest (mechanism = mechanism ):
10621070 smtp = smtplib .SMTP (HOST , self .port ,
1063- local_hostname = 'localhost' , timeout = 15 )
1071+ local_hostname = 'localhost' ,
1072+ timeout = support .LOOPBACK_TIMEOUT )
10641073 smtp .ehlo ('foo' )
10651074 smtp .user , smtp .password = sim_auth [0 ], sim_auth [1 ]
10661075 method = 'auth_' + mechanism .lower ().replace ('-' , '_' )
@@ -1071,7 +1080,7 @@ def test_auth_function(self):
10711080 def test_quit_resets_greeting (self ):
10721081 smtp = smtplib .SMTP (HOST , self .port ,
10731082 local_hostname = 'localhost' ,
1074- timeout = 15 )
1083+ timeout = support . LOOPBACK_TIMEOUT )
10751084 code , message = smtp .ehlo ()
10761085 self .assertEqual (code , 250 )
10771086 self .assertIn ('size' , smtp .esmtp_features )
@@ -1105,7 +1114,8 @@ def test_with_statement_QUIT_failure(self):
11051114
11061115 # Issue 17498: make sure _rset does not raise SMTPServerDisconnected exception
11071116 def test__rest_from_mail_cmd (self ):
1108- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1117+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1118+ timeout = support .LOOPBACK_TIMEOUT )
11091119 smtp .noop ()
11101120 self .serv ._SMTPchannel .mail_response = '451 Requested action aborted'
11111121 self .serv ._SMTPchannel .disconnect = True
@@ -1115,7 +1125,8 @@ def test__rest_from_mail_cmd(self):
11151125
11161126 # Issue 5713: make sure close, not rset, is called if we get a 421 error
11171127 def test_421_from_mail_cmd (self ):
1118- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1128+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1129+ timeout = support .LOOPBACK_TIMEOUT )
11191130 smtp .noop ()
11201131 self .serv ._SMTPchannel .mail_response = '421 closing connection'
11211132 with self .assertRaises (smtplib .SMTPSenderRefused ):
@@ -1124,7 +1135,8 @@ def test_421_from_mail_cmd(self):
11241135 self .assertEqual (self .serv ._SMTPchannel .rset_count , 0 )
11251136
11261137 def test_421_from_rcpt_cmd (self ):
1127- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1138+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1139+ timeout = support .LOOPBACK_TIMEOUT )
11281140 smtp .noop ()
11291141 self .serv ._SMTPchannel .rcpt_response = ['250 accepted' , '421 closing' ]
11301142 with self .assertRaises (smtplib .SMTPRecipientsRefused ) as r :
@@ -1141,7 +1153,8 @@ def found_terminator(self):
11411153 else :
11421154 super ().found_terminator ()
11431155 self .serv .channel_class = MySimSMTPChannel
1144- smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' , timeout = 15 )
1156+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1157+ timeout = support .LOOPBACK_TIMEOUT )
11451158 smtp .noop ()
11461159 with self .assertRaises (smtplib .SMTPDataError ):
11471160 smtp .sendmail ('John@foo.org' , ['Sally@foo.org' ], 'test message' )
@@ -1393,15 +1406,15 @@ def tearDown(self):
13931406
13941407 def testAUTH_PLAIN_initial_response_login (self ):
13951408 self .serv .add_feature ('AUTH PLAIN' )
1396- smtp = smtplib .SMTP (HOST , self .port ,
1397- local_hostname = 'localhost' , timeout = 15 )
1409+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1410+ timeout = support . LOOPBACK_TIMEOUT )
13981411 smtp .login ('psu' , 'doesnotexist' )
13991412 smtp .close ()
14001413
14011414 def testAUTH_PLAIN_initial_response_auth (self ):
14021415 self .serv .add_feature ('AUTH PLAIN' )
1403- smtp = smtplib .SMTP (HOST , self .port ,
1404- local_hostname = 'localhost' , timeout = 15 )
1416+ smtp = smtplib .SMTP (HOST , self .port , local_hostname = 'localhost' ,
1417+ timeout = support . LOOPBACK_TIMEOUT )
14051418 smtp .user = 'psu'
14061419 smtp .password = 'doesnotexist'
14071420 code , response = smtp .auth ('plain' , smtp .auth_plain )
0 commit comments