add support for mocking stdout/stderr in tests

flush `self.orig_sys_stdout`