summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exception_hierarchy.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-08-17 05:24:53 (GMT)
committerGitHub <noreply@github.com>2022-08-17 05:24:53 (GMT)
commitda0aa518bf5e6ac9de444a405c40649cfb0245eb (patch)
tree28a735c812d2edbf21a2083a0376f2ee9e181ce6 /Lib/test/test_exception_hierarchy.py
parentf51f54f39d384da63be622bcdc9cf4cfb43bad3d (diff)
downloadcpython-da0aa518bf5e6ac9de444a405c40649cfb0245eb.zip
cpython-da0aa518bf5e6ac9de444a405c40649cfb0245eb.tar.gz
cpython-da0aa518bf5e6ac9de444a405c40649cfb0245eb.tar.bz2
gh-96005: FreeBSD has ENOTCAPABLE, too (GH-96034)
Diffstat (limited to 'Lib/test/test_exception_hierarchy.py')
-rw-r--r--Lib/test/test_exception_hierarchy.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_exception_hierarchy.py b/Lib/test/test_exception_hierarchy.py
index 89fe9dd..3318fa8 100644
--- a/Lib/test/test_exception_hierarchy.py
+++ b/Lib/test/test_exception_hierarchy.py
@@ -63,7 +63,7 @@ class HierarchyTest(unittest.TestCase):
+-- InterruptedError EINTR
+-- IsADirectoryError EISDIR
+-- NotADirectoryError ENOTDIR
- +-- PermissionError EACCES, EPERM
+ +-- PermissionError EACCES, EPERM, ENOTCAPABLE
+-- ProcessLookupError ESRCH
+-- TimeoutError ETIMEDOUT
"""
@@ -75,6 +75,8 @@ class HierarchyTest(unittest.TestCase):
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)
@@ -91,7 +93,7 @@ class HierarchyTest(unittest.TestCase):
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"