16 from io
import StringIO
20 from robot.utils import console_decode, console_encode
32 LOGGER.enable_library_import_logging()
35 def __exit__(self, exc_type, exc_value, exc_trace):
38 LOGGER.disable_library_import_logging()
42 stdout, stderr = self.
_release_release()
44 LOGGER.log_output(stdout)
46 LOGGER.log_output(stderr)
47 sys.__stderr__.write(
console_encode(stderr, stream=sys.__stderr__))
89 return stream.getvalue()
97 stream.write =
lambda s:
None
98 stream.flush =
lambda:
None
def _release_and_log(self)
def __init__(self, library_import=False)
def __exit__(self, exc_type, exc_value, exc_trace)
def _set_stderr(self, stream)
def _set_stdout(self, stream)
def _avoid_at_exit_errors(self, stream)
def __init__(self, stdout=True)
def _get_value(self, stream)
def console_decode(string, encoding=CONSOLE_ENCODING)
Decodes bytes from console encoding to Unicode.
def console_encode(string, encoding=None, errors='replace', stream=sys.__stdout__, force=False)
Encodes the given string so that it can be used in the console.