
Public Member Functions | |
| def | __enter__ (self) |
| def | __exit__ (self, type, value, traceback) |
| def | __init__ (self, fd) |
| def | close (self) |
| def | output (self) |
| def | start (self) |
| def | stop (self) |
| def | write_bypass (self, value) |
Private Attributes | |
| _into_file | |
| _redirected_fd | |
| _saved_fd | |
A context-managed file to redirect output to a byte array. Use by invoking `start` (`__enter__`) and at some point invoking `stop` (`__exit__`). At any point after the initial call to `start` call `output` to get the current redirected output. Note that we don't currently use file locking, so calling `output` between calls to `start` and `stop` may muddle the result (you should only be doing this during a Python-handled interrupt as a last ditch effort to provide output to the user). Attributes: _redirected_fd (int): File descriptor of file to redirect writes from. _saved_fd (int): A copy of the original value of the redirected file descriptor. _into_file (TemporaryFile or None): File to which writes are redirected. Only non-None when self is started.
Definition at line 35 of file _runner.py.
| def tests._runner.CaptureFile.__init__ | ( | self, | |
| fd | |||
| ) |
Definition at line 53 of file _runner.py.
| def tests._runner.CaptureFile.__enter__ | ( | self | ) |
Definition at line 89 of file _runner.py.
| def tests._runner.CaptureFile.__exit__ | ( | self, | |
| type, | |||
| value, | |||
| traceback | |||
| ) |
Definition at line 93 of file _runner.py.
| def tests._runner.CaptureFile.close | ( | self | ) |
Close any resources used by self not closed by stop().
Definition at line 96 of file _runner.py.
| def tests._runner.CaptureFile.output | ( | self | ) |
Get all output from the redirected-to file if it exists.
Definition at line 58 of file _runner.py.
| def tests._runner.CaptureFile.start | ( | self | ) |
Start redirection of writes to the file descriptor.
Definition at line 66 of file _runner.py.
| def tests._runner.CaptureFile.stop | ( | self | ) |
Stop redirection of writes to the file descriptor.
Definition at line 71 of file _runner.py.
| def tests._runner.CaptureFile.write_bypass | ( | self, | |
| value | |||
| ) |
Bypass the redirection and write directly to the original file.
Arguments:
value (str): What to write to the original file.
Definition at line 76 of file _runner.py.
|
private |
Definition at line 56 of file _runner.py.
|
private |
Definition at line 54 of file _runner.py.
|
private |
Definition at line 55 of file _runner.py.