Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_os.TestInvalidFD Class Reference

List of all members.

Public Member Functions

def get_single
def check
def test_isatty
def test_closerange
def test_dup2
def test_fchmod
def test_fchown
def test_fpathconf
def test_ftruncate
def test_lseek
def test_read
def test_tcsetpgrpt
def test_write

Static Public Attributes

list singles

Detailed Description

Definition at line 726 of file test_os.py.


Member Function Documentation

def test.test_os.TestInvalidFD.check (   self,
  f,
  args 
)

Definition at line 739 of file test_os.py.

00739 
00740     def check(self, f, *args):
00741         try:
00742             f(support.make_bad_fd(), *args)
00743         except OSError as e:
00744             self.assertEqual(e.errno, errno.EBADF)
00745         else:
00746             self.fail("%r didn't raise a OSError with a bad file descriptor"
00747                       % f)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 731 of file test_os.py.

00731 
00732     def get_single(f):
00733         def helper(self):
00734             if  hasattr(os, f):
00735                 self.check(getattr(os, f))
        return helper

Here is the call graph for this function:

Definition at line 752 of file test_os.py.

00752 
00753     def test_closerange(self):
00754         if hasattr(os, "closerange"):
00755             fd = support.make_bad_fd()
00756             # Make sure none of the descriptors we are about to close are
00757             # currently valid (issue 6542).
00758             for i in range(10):
00759                 try: os.fstat(fd+i)
00760                 except OSError:
00761                     pass
00762                 else:
00763                     break
00764             if i < 2:
00765                 raise unittest.SkipTest(
00766                     "Unable to acquire a range of invalid file descriptors")
00767             self.assertEqual(os.closerange(fd, fd + i-1), None)

Here is the call graph for this function:

Definition at line 768 of file test_os.py.

00768 
00769     def test_dup2(self):
00770         if hasattr(os, "dup2"):
00771             self.check(os.dup2, 20)

Here is the call graph for this function:

Definition at line 772 of file test_os.py.

00772 
00773     def test_fchmod(self):
00774         if hasattr(os, "fchmod"):
00775             self.check(os.fchmod, 0)

Here is the call graph for this function:

Definition at line 776 of file test_os.py.

00776 
00777     def test_fchown(self):
00778         if hasattr(os, "fchown"):
00779             self.check(os.fchown, -1, -1)

Here is the call graph for this function:

Definition at line 780 of file test_os.py.

00780 
00781     def test_fpathconf(self):
00782         if hasattr(os, "fpathconf"):
00783             self.check(os.fpathconf, "PC_NAME_MAX")

Here is the call graph for this function:

Definition at line 784 of file test_os.py.

00784 
00785     def test_ftruncate(self):
00786         if hasattr(os, "ftruncate"):
00787             self.check(os.ftruncate, 0)

Here is the call graph for this function:

Definition at line 748 of file test_os.py.

00748 
00749     def test_isatty(self):
00750         if hasattr(os, "isatty"):
00751             self.assertEqual(os.isatty(support.make_bad_fd()), False)

Here is the call graph for this function:

Definition at line 788 of file test_os.py.

00788 
00789     def test_lseek(self):
00790         if hasattr(os, "lseek"):
00791             self.check(os.lseek, 0, 0)

Here is the call graph for this function:

Definition at line 792 of file test_os.py.

00792 
00793     def test_read(self):
00794         if hasattr(os, "read"):
00795             self.check(os.read, 1)

Here is the call graph for this function:

Definition at line 796 of file test_os.py.

00796 
00797     def test_tcsetpgrpt(self):
00798         if hasattr(os, "tcsetpgrp"):
00799             self.check(os.tcsetpgrp, 0)

Here is the call graph for this function:

Definition at line 800 of file test_os.py.

00800 
00801     def test_write(self):
00802         if hasattr(os, "write"):
00803             self.check(os.write, b" ")
00804 

Here is the call graph for this function:


Member Data Documentation

Initial value:
["fchdir", "dup", "fdopen", "fdatasync", "fstat",
               "fstatvfs", "fsync", "tcgetpgrp", "ttyname"]

Definition at line 727 of file test_os.py.


The documentation for this class was generated from the following file: