Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Lib/test/test_exception_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import unittest
import errno
from errno import EEXIST
import sys


class SubOSError(OSError):
Expand Down Expand Up @@ -41,10 +40,10 @@ def test_builtin_errors(self):
self.assertIs(EnvironmentError, OSError)

def test_socket_errors(self):
self.assertIs(socket.error, IOError)
self.assertIs(socket.error, OSError)
self.assertIs(socket.gaierror.__base__, OSError)
self.assertIs(socket.herror.__base__, OSError)
self.assertIs(socket.timeout.__base__, OSError)
self.assertIs(socket.timeout, TimeoutError)

def test_select_error(self):
self.assertIs(select.error, OSError)
Expand All @@ -64,7 +63,7 @@ def test_select_error(self):
+-- InterruptedError EINTR
+-- IsADirectoryError EISDIR
+-- NotADirectoryError ENOTDIR
+-- PermissionError EACCES, EPERM
+-- PermissionError EACCES, EPERM, ENOTCAPABLE
+-- ProcessLookupError ESRCH
+-- TimeoutError ETIMEDOUT
"""
Expand All @@ -76,6 +75,8 @@ def _make_map(s):
continue
excname, _, errnames = line.partition(' ')
for errname in filter(None, errnames.strip().split(', ')):
if errname == "ENOTCAPABLE" and not hasattr(errno, errname):
continue
_map[getattr(errno, errname)] = getattr(builtins, excname)
return _map
_map = _make_map(_pep_map)
Expand All @@ -93,7 +94,7 @@ def test_errno_mapping(self):
othercodes = set(errno.errorcode) - set(self._map)
for errcode in othercodes:
e = OSError(errcode, "Some message")
self.assertIs(type(e), OSError)
self.assertIs(type(e), OSError, repr(e))

def test_try_except(self):
filename = "some_hopefully_non_existing_file"
Expand Down Expand Up @@ -128,7 +129,6 @@ def test_windows_error(self):
self.assertNotIn('winerror', dir(OSError))

@unittest.skip("TODO: RUSTPYTHON")
@unittest.skipIf(sys.platform == 'win32', 'winerror not filled yet')
def test_posix_error(self):
e = OSError(EEXIST, "File already exists", "foo.txt")
self.assertEqual(e.errno, EEXIST)
Expand Down