diff options
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index baaf33a..51663e1 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3,6 +3,7 @@ # portable than they had been thought to be. import os +import errno import unittest import warnings import sys @@ -277,7 +278,6 @@ class StatAttributeTests(unittest.TestCase): result = os.statvfs(self.fname) except OSError as e: # On AtheOS, glibc always returns ENOSYS - import errno if e.errno == errno.ENOSYS: return @@ -601,7 +601,13 @@ class TestInvalidFD(unittest.TestCase): locals()["test_"+f] = get_single(f) def check(self, f, *args): - self.assertRaises(OSError, f, support.make_bad_fd(), *args) + try: + f(support.make_bad_fd(), *args) + except OSError as e: + self.assertEqual(e.errno, errno.EBADF) + else: + self.fail("%r didn't raise a OSError with a bad file descriptor" + % f) def test_isatty(self): if hasattr(os, "isatty"): |