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:
Senthil Kumaran 2011-07-31 09:14:17 +08:00
parent 3fc5868a1d
commit b351a48eee
3 changed files with 39 additions and 28 deletions

View file

@ -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)