twisted.test.test_process.MockOS(object) class documentationtwisted.test.test_process
(View In Hierarchy)
| Instance Variable | exited | set to True when _exitis called. (type:bool) | 
| Instance Variable | O_RDWR | dumb value faking os.O_RDWR. (type:int) | 
| Instance Variable | O_NOCTTY | dumb value faking os.O_NOCTTY. (type:int) | 
| Instance Variable | WNOHANG | dumb value faking os.WNOHANG. (type:int) | 
| Instance Variable | raiseFork | if not None,
subsequent calls to fork will raise this object. (type:NoneorException) | 
| Instance Variable | raiseExec | if set, subsequent calls to execvpe will raise an error. (type: bool) | 
| Instance Variable | fdio | fake file object returned by calls to fdopen. (type: BytesIOorBytesIO) | 
| Instance Variable | actions | hold names of some actions executed by the object, in order of execution. (type: listofstr) | 
| Instance Variable | closed | keep track of the file descriptor closed. (type: listofint) | 
| Instance Variable | child | whether fork return for the child or the parent. (type: bool) | 
| Instance Variable | pipeCount | count the number of time that os.pipehas been called. (type:int) | 
| Instance Variable | raiseWaitPid | if set, subsequent calls to waitpid will raise the error specified. (type: Noneor a class) | 
| Instance Variable | waitChild | if set, subsequent calls to waitpid will return it. (type: Noneor a tuple) | 
| Instance Variable | euid | the uid returned by the fake os.geteuid(type:int) | 
| Instance Variable | egid | the gid returned by the fake os.getegid(type:int) | 
| Instance Variable | seteuidCalls | stored results of os.seteuidcalls. (type:list) | 
| Instance Variable | setegidCalls | stored results of os.setegidcalls. (type:list) | 
| Instance Variable | path | the path returned by os.path.expanduser. (type:str) | 
| Instance Variable | raiseKill | if set, subsequent call to kill will raise the error specified. (type: Noneor an exception instance.) | 
| Instance Variable | readData | data returned by os.read. (type:str) | 
| Method | __init__ | Initialize data structures. | 
| Method | open | Fake os.open. Return a non fd number to be sure it's not 
used elsewhere. | 
| Method | fstat | Fake os.fstat.  Return aos.stat_resultfilled
with garbage. | 
| Method | fdopen | Fake os.fdopen. Return a file-like object whose content can
be tested later viaself.fdio. | 
| Method | setsid | Fake os.setsid. Save action. | 
| Method | fork | Fake os.fork. Save the action inself.actions,
and return 0 ifself.childis set, or a dumb number. | 
| Method | close | Fake os.close, saving the closed fd inself.closed. | 
| Method | dup2 | Fake os.dup2. Do nothing. | 
| Method | write | Fake os.write. Save action. | 
| Method | read | Fake os.read: save action, and returnreadDatacontent. | 
| Method | execvpe | Fake os.execvpe. Save the action, and raise an error ifself.raiseExecis set. | 
| Method | pipe | Fake os.pipe. Return non fd numbers to be sure it's not 
used elsewhere, and incrementself.pipeCount. This is used to 
uniquify the result. | 
| Method | ttyname | Fake os.ttyname. Return a dumb string. | 
| Method | ioctl | Override fcntl.ioctl. Do nothing. | 
| Method | setNonBlocking | Override fdesc.setNonBlocking. Do nothing. | 
| Method | waitpid | Override os.waitpid. Return values meaning that the child 
process has exited, save executed action. | 
| Method | settrace | Override sys.settraceto keep coverage working. | 
| Method | getgid | Override os.getgid. Return a dumb number. | 
| Method | getuid | Override os.getuid. Return a dumb number. | 
| Method | setuid | Override os.setuid. Do nothing. | 
| Method | setgid | Override os.setgid. Do nothing. | 
| Method | setregid | Override os.setregid. Do nothing. | 
| Method | setreuid | Override os.setreuid.  Save the action. | 
| Method | switchUID | Override util.switchUID. 
Save the action. | 
| Method | openpty | Override pty.openpty, returning fake file descriptors. | 
| Method | chdir | Override os.chdir. Save the action. | 
| Method | geteuid | Mock os.geteuid, returningself.euidinstead. | 
| Method | getegid | Mock os.getegid, returningself.egidinstead. | 
| Method | seteuid | Mock os.seteuid, store result. | 
| Method | setegid | Mock os.setegid, store result. | 
| Method | expanduser | Mock os.path.expanduser. | 
| Method | getpwnam | Mock pwd.getpwnam. | 
| Method | listdir | Override os.listdir, returning fake contents of 
'/dev/fd' | 
| Method | kill | Override os.kill: save the action and raiseself.raiseKillif specified. | 
| Method | unlink | Override os.unlink. Save the action. | 
| Method | umask | Override os.umask. Save the action. | 
| Method | getpid | Return a fixed PID value. | 
| Method | getfilesystemencoding | Return a fixed filesystem encoding. | 
| Method | _exit | Fake os._exit. Save the action, set theself.exitedflag, and raiseSystemError. | 
list of str)
  None
or a class)
  None
or an exception instance.)
  Fake os.open. Return a non fd number to be sure it's not 
used elsewhere.
Fake os.fdopen. Return a file-like object whose content can
be tested later via self.fdio.
Fake os.fork. Save the action in self.actions,
and return 0 if self.child is set, or a dumb number.
Fake os.read: save action, and return readData
content.
| Parameters | fd | The file descriptor to read. | 
| size | The maximum number of bytes to read. | |
| Returns | A fixed bytesbuffer. | |
Fake os.execvpe. Save the action, and raise an error if 
self.raiseExec is set.
Fake os.pipe. Return non fd numbers to be sure it's not 
used elsewhere, and increment self.pipeCount. This is used to 
uniquify the result.
Fake os._exit. Save the action, set the 
self.exited flag, and raise SystemError.
Override os.waitpid. Return values meaning that the child 
process has exited, save executed action.
Override os.chdir. Save the action.
| Parameters | path | The path to change the current directory to. | 
Override os.kill: save the action and raise 
self.raiseKill if specified.
Override os.unlink. Save the action.
| Parameters | filename | The file name to remove. |