コード例 #1
0
    def test_remove_directory(self):
        """Test file_impl.remove_directory."""
        os.mkdir('/dir')
        request = untrusted_runner_pb2.RemoveDirectoryRequest(path='/dir',
                                                              recreate=False)
        response = file_impl.remove_directory(request, None)
        self.assertTrue(response.result)
        self.assertFalse(os.path.isdir('/dir'))

        os.mkdir('/dir')
        request = untrusted_runner_pb2.RemoveDirectoryRequest(path='/dir',
                                                              recreate=True)
        response = file_impl.remove_directory(request, None)
        self.assertTrue(response.result)
        self.assertTrue(os.path.isdir('/dir'))
コード例 #2
0
ファイル: file_host.py プロジェクト: wdgreen/clusterfuzz
def remove_directory(path, recreate=False):
  """Remove a directory. If |recreate| is set, always creates the directory even
  if it did not exist."""
  request = untrusted_runner_pb2.RemoveDirectoryRequest(
      path=path, recreate=recreate)

  response = host.stub().RemoveDirectory(request)
  return response.result