diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-09-01 19:38:37 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-09-01 19:38:37 (GMT) |
commit | 5edbaf295e60e0152c3f240ebef6408fa74572c3 (patch) | |
tree | 591b5c7e0b8d3a941b73a46d1151a5026cf2887d /Lib/test/test_exceptions.py | |
parent | c2d9a0226e785c6a77fc0de776f2eece92eebadb (diff) | |
parent | a762285831d1591d5c621394f8f6be45688ba33d (diff) | |
download | cpython-5edbaf295e60e0152c3f240ebef6408fa74572c3.zip cpython-5edbaf295e60e0152c3f240ebef6408fa74572c3.tar.gz cpython-5edbaf295e60e0152c3f240ebef6408fa74572c3.tar.bz2 |
Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
mapped to POSIX errno ENOTDIR (previously EINVAL).
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 718d05c..9be6958 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -5,6 +5,7 @@ import sys import unittest import pickle import weakref +import errno from test.support import (TESTFN, unlink, run_unittest, captured_output, gc_collect, cpython_only, no_tracing) @@ -852,6 +853,13 @@ class ExceptionTests(unittest.TestCase): self.fail("RuntimeError not raised") self.assertEqual(wr(), None) + def test_errno_ENOTDIR(self): + # Issue #12802: "not a directory" errors are ENOTDIR even on Windows + with self.assertRaises(OSError) as cm: + os.listdir(__file__) + self.assertEqual(cm.exception.errno, errno.ENOTDIR, cm.exception) + + def test_main(): run_unittest(ExceptionTests) |