Path: blob/main_old/scripts/angle_presubmit_utils.py
1693 views
#!/usr/bin/env python1# Copyright 2020 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4"""5angle_presubmit_utils: Mock depot_tools class for ANGLE presubmit checks's unittests6"""789class Change_mock():1011def __init__(self, description_text):12self.description_text = description_text1314def DescriptionText(self):15return self.description_text161718class InputAPI_mock():1920def __init__(self, description_text):21self.change = Change_mock(description_text)222324class _PresubmitResult(object):25"""Base class for result objects."""26fatal = False27should_prompt = False2829def __init__(self, message):30self._message = message3132def __eq__(self, other):33return self.fatal == other.fatal and self.should_prompt == other.should_prompt \34and self._message == other._message353637# Top level object so multiprocessing can pickle38# Public access through OutputApi object.39class _PresubmitError(_PresubmitResult):40"""A hard presubmit error."""41fatal = True424344# Top level object so multiprocessing can pickle45# Public access through OutputApi object.46class _PresubmitPromptWarning(_PresubmitResult):47"""An warning that prompts the user if they want to continue."""48should_prompt = True495051# Top level object so multiprocessing can pickle52# Public access through OutputApi object.53class _PresubmitNotifyResult(_PresubmitResult):54"""Just print something to the screen -- but it's not even a warning."""55pass565758class OutputAPI_mock():59PresubmitResult = _PresubmitResult60PresubmitError = _PresubmitError61PresubmitPromptWarning = _PresubmitPromptWarning62PresubmitNotifyResult = _PresubmitNotifyResult636465