diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-17 16:57:16 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-17 16:57:16 (GMT) |
commit | 2ade6f24cb4ac21b9da36b0e1ce7414463c9f5d5 (patch) | |
tree | b11f2f094692b1189522f6d08619eb7b99028d50 /Lib/test | |
parent | df485ca493b52dd8f1848794b5a58e3c3d8e92b1 (diff) | |
parent | 3b69824de9860899372d3b816a0601889e2a0031 (diff) | |
download | cpython-2ade6f24cb4ac21b9da36b0e1ce7414463c9f5d5.zip cpython-2ade6f24cb4ac21b9da36b0e1ce7414463c9f5d5.tar.gz cpython-2ade6f24cb4ac21b9da36b0e1ce7414463c9f5d5.tar.bz2 |
Issue #16647: save socket error details in LMTP.connect()
Initial patch by Serhiy Storchaka.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/mock_socket.py | 8 | ||||
-rw-r--r-- | Lib/test/test_smtplib.py | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/Lib/test/mock_socket.py b/Lib/test/mock_socket.py index d09e78c..8ef0ec8 100644 --- a/Lib/test/mock_socket.py +++ b/Lib/test/mock_socket.py @@ -140,12 +140,8 @@ def gethostbyname(name): return "" -class gaierror(Exception): - pass - - -class error(Exception): - pass +gaierror = socket_module.gaierror +error = socket_module.error # Constants diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index befc49e..6fe2df9 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -542,9 +542,9 @@ class NonConnectingTests(unittest.TestCase): def testNonnumericPort(self): # check that non-numeric port raises socket.error - self.assertRaises(mock_socket.error, smtplib.SMTP, + self.assertRaises(OSError, smtplib.SMTP, "localhost", "bogus") - self.assertRaises(mock_socket.error, smtplib.SMTP, + self.assertRaises(OSError, smtplib.SMTP, "localhost:bogus") |