Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_os Namespace Reference

Classes

class  FileTests
class  StatAttributeTests
class  EnvironTests
class  WalkTests
class  MakedirTests
class  DevNullTests
class  URandomTests
class  ExecTests
class  Win32ErrorTests
class  TestInvalidFD
class  LinkTests
class  PosixUidGidTests
class  Pep383Tests
class  Win32KillTests
class  Win32SymlinkTests
class  FSEncodingTests
class  PidTests
class  LoginTests

Functions

def _execvpe_mockup
def test_main

Variables

tuple libpthread = os.confstr("CS_GNU_LIBPTHREAD_VERSION")
tuple USING_LINUXTHREADS = libpthread.startswith("linuxthreads")

Function Documentation

def test.test_os._execvpe_mockup (   defpath = None) [private]
Stubs out execv and execve functions when used as context manager.
Records exec calls. The mock execv and execve functions always raise an
exception as they would normally never return.

Definition at line 605 of file test_os.py.

00605 
00606 def _execvpe_mockup(defpath=None):
00607     """
00608     Stubs out execv and execve functions when used as context manager.
00609     Records exec calls. The mock execv and execve functions always raise an
00610     exception as they would normally never return.
00611     """
00612     # A list of tuples containing (function name, first arg, args)
00613     # of calls to execv or execve that have been made.
00614     calls = []
00615 
00616     def mock_execv(name, *args):
00617         calls.append(('execv', name, args))
00618         raise RuntimeError("execv called")
00619 
00620     def mock_execve(name, *args):
00621         calls.append(('execve', name, args))
00622         raise OSError(errno.ENOTDIR, "execve called")
00623 
00624     try:
00625         orig_execv = os.execv
00626         orig_execve = os.execve
00627         orig_defpath = os.defpath
00628         os.execv = mock_execv
00629         os.execve = mock_execve
00630         if defpath is not None:
00631             os.defpath = defpath
00632         yield calls
00633     finally:
00634         os.execv = orig_execv
00635         os.execve = orig_execve
00636         os.defpath = orig_defpath

Here is the caller graph for this function:

Definition at line 1223 of file test_os.py.

01223 
01224 def test_main():
01225     support.run_unittest(
01226         FileTests,
01227         StatAttributeTests,
01228         EnvironTests,
01229         WalkTests,
01230         MakedirTests,
01231         DevNullTests,
01232         URandomTests,
01233         ExecTests,
01234         Win32ErrorTests,
01235         TestInvalidFD,
01236         PosixUidGidTests,
01237         Pep383Tests,
01238         Win32KillTests,
01239         Win32SymlinkTests,
01240         FSEncodingTests,
01241         PidTests,
01242         LoginTests,
01243         LinkTests,
01244     )


Variable Documentation

tuple test.test_os.libpthread = os.confstr("CS_GNU_LIBPTHREAD_VERSION")

Definition at line 25 of file test_os.py.

test.test_os.USING_LINUXTHREADS = libpthread.startswith("linuxthreads")

Definition at line 26 of file test_os.py.