def tearDown(self):
    super(GsUtilUnitTestCase, self).tearDown()

    self.root_logger.handlers = self.log_handlers_save
    self.temp_log_handler.flush()
    self.temp_log_handler.close()
    self.log_handler_stream.seek(0)
    log_output = self.log_handler_stream.read()
    self.log_handler_stream.close()
    os.unlink(self.log_handler_file)

    sys.stdout.seek(0)
    sys.stderr.seek(0)
    stdout = sys.stdout.read()
    stderr = sys.stderr.read()
    stdout += ''.join(self.accumulated_stdout)
    stderr += ''.join(self.accumulated_stderr)
    sys.stdout.close()
    sys.stderr.close()
    sys.stdout = self.stdout_save
    sys.stderr = self.stderr_save
    os.unlink(self.stdout_file)
    os.unlink(self.stderr_file)

    if self.is_debugging and stdout:
      sys.stderr.write('==== stdout %s ====\n' % self.id())
      sys.stderr.write(stdout)
      sys.stderr.write('==== end stdout ====\n')
    if self.is_debugging and stderr:
      sys.stderr.write('==== stderr %s ====\n' % self.id())
      sys.stderr.write(stderr)
      sys.stderr.write('==== end stderr ====\n')
    if self.is_debugging and log_output:
      sys.stderr.write('==== log output %s ====\n' % self.id())
      sys.stderr.write(log_output)
      sys.stderr.write('==== end log output ====\n')
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/tests/testcase/unit_testcase.py/GsUtilUnitTestCase.tearDown/original