@@ -964,11 +964,13 @@ def tearDown(self):
964
964
965
965
def testBasic (self ):
966
966
# 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 )
968
969
smtp .quit ()
969
970
970
971
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 )
972
974
973
975
# no features should be present before the EHLO
974
976
self .assertEqual (smtp .esmtp_features , {})
@@ -989,7 +991,8 @@ def testEHLO(self):
989
991
smtp .quit ()
990
992
991
993
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 )
993
996
994
997
for addr_spec , name in sim_users .items ():
995
998
expected_known = (250 , bytes ('%s %s' %
@@ -1003,7 +1006,8 @@ def testVRFY(self):
1003
1006
smtp .quit ()
1004
1007
1005
1008
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 )
1007
1011
1008
1012
for listname , members in sim_lists .items ():
1009
1013
users = []
@@ -1019,30 +1023,34 @@ def testEXPN(self):
1019
1023
1020
1024
def testAUTH_PLAIN (self ):
1021
1025
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 )
1023
1028
resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
1024
1029
self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
1025
1030
smtp .close ()
1026
1031
1027
1032
def testAUTH_LOGIN (self ):
1028
1033
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 )
1030
1036
resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
1031
1037
self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
1032
1038
smtp .close ()
1033
1039
1034
1040
@requires_hashdigest ('md5' )
1035
1041
def testAUTH_CRAM_MD5 (self ):
1036
1042
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 )
1038
1045
resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
1039
1046
self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
1040
1047
smtp .close ()
1041
1048
1042
1049
def testAUTH_multiple (self ):
1043
1050
# Test that multiple authentication methods are tried.
1044
1051
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 )
1046
1054
resp = smtp .login (sim_auth [0 ], sim_auth [1 ])
1047
1055
self .assertEqual (resp , (235 , b'Authentication Succeeded' ))
1048
1056
smtp .close ()
@@ -1060,7 +1068,8 @@ def test_auth_function(self):
1060
1068
for mechanism in supported :
1061
1069
with self .subTest (mechanism = mechanism ):
1062
1070
smtp = smtplib .SMTP (HOST , self .port ,
1063
- local_hostname = 'localhost' , timeout = 15 )
1071
+ local_hostname = 'localhost' ,
1072
+ timeout = support .LOOPBACK_TIMEOUT )
1064
1073
smtp .ehlo ('foo' )
1065
1074
smtp .user , smtp .password = sim_auth [0 ], sim_auth [1 ]
1066
1075
method = 'auth_' + mechanism .lower ().replace ('-' , '_' )
@@ -1071,7 +1080,7 @@ def test_auth_function(self):
1071
1080
def test_quit_resets_greeting (self ):
1072
1081
smtp = smtplib .SMTP (HOST , self .port ,
1073
1082
local_hostname = 'localhost' ,
1074
- timeout = 15 )
1083
+ timeout = support . LOOPBACK_TIMEOUT )
1075
1084
code , message = smtp .ehlo ()
1076
1085
self .assertEqual (code , 250 )
1077
1086
self .assertIn ('size' , smtp .esmtp_features )
@@ -1105,7 +1114,8 @@ def test_with_statement_QUIT_failure(self):
1105
1114
1106
1115
# Issue 17498: make sure _rset does not raise SMTPServerDisconnected exception
1107
1116
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 )
1109
1119
smtp .noop ()
1110
1120
self .serv ._SMTPchannel .mail_response = '451 Requested action aborted'
1111
1121
self .serv ._SMTPchannel .disconnect = True
@@ -1115,7 +1125,8 @@ def test__rest_from_mail_cmd(self):
1115
1125
1116
1126
# Issue 5713: make sure close, not rset, is called if we get a 421 error
1117
1127
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 )
1119
1130
smtp .noop ()
1120
1131
self .serv ._SMTPchannel .mail_response = '421 closing connection'
1121
1132
with self .assertRaises (smtplib .SMTPSenderRefused ):
@@ -1124,7 +1135,8 @@ def test_421_from_mail_cmd(self):
1124
1135
self .assertEqual (self .serv ._SMTPchannel .rset_count , 0 )
1125
1136
1126
1137
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 )
1128
1140
smtp .noop ()
1129
1141
self .serv ._SMTPchannel .rcpt_response = ['250 accepted' , '421 closing' ]
1130
1142
with self .assertRaises (smtplib .SMTPRecipientsRefused ) as r :
@@ -1141,7 +1153,8 @@ def found_terminator(self):
1141
1153
else :
1142
1154
super ().found_terminator ()
1143
1155
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 )
1145
1158
smtp .noop ()
1146
1159
with self .assertRaises (smtplib .SMTPDataError ):
1147
1160
smtp .
sendmail (
'[email protected] ' , [
'[email protected] ' ],
'test message' )
@@ -1393,15 +1406,15 @@ def tearDown(self):
1393
1406
1394
1407
def testAUTH_PLAIN_initial_response_login (self ):
1395
1408
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 )
1398
1411
smtp .login ('psu' , 'doesnotexist' )
1399
1412
smtp .close ()
1400
1413
1401
1414
def testAUTH_PLAIN_initial_response_auth (self ):
1402
1415
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 )
1405
1418
smtp .user = 'psu'
1406
1419
smtp .password = 'doesnotexist'
1407
1420
code , response = smtp .auth ('plain' , smtp .auth_plain )
0 commit comments