Python test.test_support.make_bad_fd() Examples
The following are 26
code examples of test.test_support.make_bad_fd().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
test.test_support
, or try the search function
.
Example #1
Source File: test_os.py From oss-ftp with MIT License | 5 votes |
def test_closerange(self): fd = test_support.make_bad_fd() # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). for i in range(10): try: os.fstat(fd+i) except OSError: pass else: break if i < 2: raise unittest.SkipTest( "Unable to acquire a range of invalid file descriptors") self.assertEqual(os.closerange(fd, fd + i-1), None)
Example #2
Source File: test_os.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_closerange(self): if hasattr(os, "closerange"): fd = int(test_support.make_bad_fd()) # need to take an int for Jython, given this test # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). for i in range(10): try: os.fstat(fd+i) except OSError: pass else: break if i < 2: raise unittest.SkipTest( "Unable to acquire a range of invalid file descriptors") self.assertEqual(os.closerange(fd, fd + i-1), None)
Example #3
Source File: test_os.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_isatty(self): if hasattr(os, "isatty"): self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
Example #4
Source File: test_os.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def check(self, f, *args): try: fd = test_support.make_bad_fd() f(fd, *args) except OSError as e: self.assertEqual(e.errno, errno.EBADF) except ValueError: self.assertTrue(test_support.is_jython) else: self.fail("%r didn't raise a OSError with a bad file descriptor" % f)
Example #5
Source File: test_os.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_closerange(self): if hasattr(os, "closerange"): fd = int(test_support.make_bad_fd()) # need to take an int for Jython, given this test # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). for i in range(10): try: os.fstat(fd+i) except OSError: pass else: break if i < 2: raise unittest.SkipTest( "Unable to acquire a range of invalid file descriptors") self.assertEqual(os.closerange(fd, fd + i-1), None)
Example #6
Source File: test_os.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_isatty(self): if hasattr(os, "isatty"): self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
Example #7
Source File: test_os.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def check(self, f, *args): try: fd = test_support.make_bad_fd() f(fd, *args) except OSError as e: self.assertEqual(e.errno, errno.EBADF) except ValueError: self.assertTrue(test_support.is_jython) else: self.fail("%r didn't raise a OSError with a bad file descriptor" % f)
Example #8
Source File: test_fileio.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def testInvalidFd(self): self.assertRaises(ValueError, _FileIO, -10) self.assertRaises(OSError, _FileIO, make_bad_fd()) if sys.platform == 'win32': import msvcrt self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
Example #9
Source File: test_os.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_closerange(self): fd = test_support.make_bad_fd() # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). for i in range(10): try: os.fstat(fd+i) except OSError: pass else: break if i < 2: raise unittest.SkipTest( "Unable to acquire a range of invalid file descriptors") self.assertEqual(os.closerange(fd, fd + i-1), None)
Example #10
Source File: test_os.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_isatty(self): self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
Example #11
Source File: test_os.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def check(self, f, *args): try: f(test_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)
Example #12
Source File: test_signal.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_invalid_fd(self): fd = test_support.make_bad_fd() self.assertRaises(ValueError, signal.set_wakeup_fd, fd)
Example #13
Source File: test_fileio.py From oss-ftp with MIT License | 5 votes |
def testInvalidFd(self): self.assertRaises(ValueError, _FileIO, -10) self.assertRaises(OSError, _FileIO, make_bad_fd()) if sys.platform == 'win32': import msvcrt self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
Example #14
Source File: test_signal.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_invalid_fd(self): fd = test_support.make_bad_fd() self.assertRaises(ValueError, signal.set_wakeup_fd, fd)
Example #15
Source File: test_os.py From oss-ftp with MIT License | 5 votes |
def test_isatty(self): self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
Example #16
Source File: test_os.py From oss-ftp with MIT License | 5 votes |
def check(self, f, *args): try: f(test_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)
Example #17
Source File: test_signal.py From oss-ftp with MIT License | 5 votes |
def test_invalid_fd(self): fd = test_support.make_bad_fd() self.assertRaises(ValueError, signal.set_wakeup_fd, fd)
Example #18
Source File: test_fileio.py From BinderFilter with MIT License | 5 votes |
def testInvalidFd(self): self.assertRaises(ValueError, _FileIO, -10) self.assertRaises(OSError, _FileIO, make_bad_fd()) if sys.platform == 'win32': import msvcrt self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd()) # Issue 15989 self.assertRaises(TypeError, _FileIO, _testcapi.INT_MAX + 1) self.assertRaises(TypeError, _FileIO, _testcapi.INT_MIN - 1)
Example #19
Source File: test_os.py From BinderFilter with MIT License | 5 votes |
def test_closerange(self): if hasattr(os, "closerange"): fd = test_support.make_bad_fd() # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). for i in range(10): try: os.fstat(fd+i) except OSError: pass else: break if i < 2: raise unittest.SkipTest( "Unable to acquire a range of invalid file descriptors") self.assertEqual(os.closerange(fd, fd + i-1), None)
Example #20
Source File: test_os.py From BinderFilter with MIT License | 5 votes |
def test_isatty(self): if hasattr(os, "isatty"): self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
Example #21
Source File: test_os.py From BinderFilter with MIT License | 5 votes |
def check(self, f, *args): try: f(test_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)
Example #22
Source File: test_signal.py From BinderFilter with MIT License | 5 votes |
def test_invalid_fd(self): fd = test_support.make_bad_fd() self.assertRaises(ValueError, signal.set_wakeup_fd, fd)
Example #23
Source File: test_fileio.py From ironpython2 with Apache License 2.0 | 5 votes |
def testInvalidFd(self): self.assertRaises(ValueError, _FileIO, -10) self.assertRaises(OSError, _FileIO, make_bad_fd()) if sys.platform == 'win32': import msvcrt self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
Example #24
Source File: test_os.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_closerange(self): fd = test_support.make_bad_fd() # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). for i in range(10): try: os.fstat(fd+i) except OSError: pass else: break if i < 2: raise unittest.SkipTest( "Unable to acquire a range of invalid file descriptors") self.assertEqual(os.closerange(fd, fd + i-1), None)
Example #25
Source File: test_os.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_isatty(self): self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
Example #26
Source File: test_os.py From ironpython2 with Apache License 2.0 | 5 votes |
def check(self, f, *args): try: f(test_support.make_bad_fd(), *args) except OSError as e: self.assertEqual(e.errno, errno.EBADF) else: self.fail("%r didn't raise an OSError with a bad file descriptor" % f)