diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-07-31 01:14:17 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-07-31 01:14:17 (GMT) |
commit | b351a48eee11b8fc19bd7502db0bab02135b69b5 (patch) | |
tree | 7c442d00c0a61b6fcfba744929e7d871d5a3a7c1 /Lib/test/test_smtplib.py | |
parent | 3fc5868a1d123996936c2feb6625865f5bb88b37 (diff) | |
download | cpython-b351a48eee11b8fc19bd7502db0bab02135b69b5.zip cpython-b351a48eee11b8fc19bd7502db0bab02135b69b5.tar.gz cpython-b351a48eee11b8fc19bd7502db0bab02135b69b5.tar.bz2 |
Addressing the review comments by Antoine Pitrou for smtplib.py and test_smtplib.py. Review comments by Ezio Melotti for smtplib.rst
Diffstat (limited to 'Lib/test/test_smtplib.py')
-rw-r--r-- | Lib/test/test_smtplib.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 70654c5..969ff15 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -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) |