diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-09-01 19:37:43 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-09-01 19:37:43 (GMT) |
commit | a762285831d1591d5c621394f8f6be45688ba33d (patch) | |
tree | 5e24a13489617c5f68dede866921bcc92b46e4d1 /Lib/test/test_exceptions.py | |
parent | 222b20844f28f37dbe5431eb293ef2b35df71ae7 (diff) | |
download | cpython-a762285831d1591d5c621394f8f6be45688ba33d.zip cpython-a762285831d1591d5c621394f8f6be45688ba33d.tar.gz cpython-a762285831d1591d5c621394f8f6be45688ba33d.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 d3c0062..0a7ddd4 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) @@ -849,6 +850,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) |