def testRenamingErrorWithRemoveError(self):
    extra_error = OSError('A problem removing!')
    os.rename(self.temp_filename, self.file_path).AndRaise(self.os_error)
    os.remove(self.temp_filename).AndRaise(extra_error)
    self.mox.ReplayAll()
    try:
      file_util.AtomicWrite(self.file_path, self.sample_contents,
                            mode=self.mode)
    except __HOLE__ as e:
      self.assertEquals(str(e),
                        'A problem renaming!. Additional errors cleaning up: '
                        'A problem removing!')
    else:
      raise self.failureException('OSError not raised by AtomicWrite')
    self.mox.VerifyAll()
dataset/ETHPy150Open google/google-apputils/tests/file_util_test.py/AtomicWriteMoxTest.testRenamingErrorWithRemoveError