mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Addressing the review comments by Antoine Pitrou for smtplib.py and test_smtplib.py. Review comments by Ezio Melotti for smtplib.rst
This commit is contained in:
parent
3fc5868a1d
commit
b351a48eee
3 changed files with 39 additions and 28 deletions
|
@ -216,12 +216,17 @@ class DebuggingServerTests(unittest.TestCase):
|
|||
|
||||
def testSourceAddress(self):
|
||||
# connect
|
||||
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3,
|
||||
source_address=('127.0.0.1', 19876))
|
||||
self.assertEqual(smtp.source_address, ('127.0.0.1', 19876))
|
||||
self.assertEqual(smtp.local_hostname, 'localhost')
|
||||
print(dir(smtp))
|
||||
smtp.quit()
|
||||
port = support.find_unused_port()
|
||||
try:
|
||||
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
|
||||
timeout=3, source_address=('127.0.0.1', port))
|
||||
self.assertEqual(smtp.source_address, ('127.0.0.1', port))
|
||||
self.assertEqual(smtp.local_hostname, 'localhost')
|
||||
smtp.quit()
|
||||
except IOError as e:
|
||||
if e.errno == errno.EADDRINUSE:
|
||||
self.skipTest("couldn't bind to port %d" % port)
|
||||
raise
|
||||
|
||||
def testNOOP(self):
|
||||
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue