diff options
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r-- | Lib/test/test_fileio.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py index a676bc2..0404a19 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -100,6 +100,17 @@ class AutoFileTests(unittest.TestCase): # should raise on closed file self.assertRaises(ValueError, method) + def testOpendir(self): + # Issue 3703: opening a directory should fill the errno + # Windows always returns "[Errno 13]: Permission denied + # Unix calls dircheck() and returns "[Errno 21]: Is a directory" + try: + _fileio._FileIO('.', 'r') + except IOError as e: + self.assertNotEqual(e.errno, 0) + else: + self.fail("Should have raised IOError") + class OtherFileTests(unittest.TestCase): |