blob: ff902c2736654c3965c65e4071d110cb6c69e756 [file] [log] [blame]
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
from pylint.testutils.global_test_linter import linter
from pylint.testutils.output_line import Message
class UnittestLinter:
"""A fake linter class to capture checker messages."""
# pylint: disable=unused-argument, no-self-use
def __init__(self):
self._messages = []
self.stats = {}
def release_messages(self):
try:
return self._messages
finally:
self._messages = []
def add_message(
self, msg_id, line=None, node=None, args=None, confidence=None, col_offset=None
):
# Do not test col_offset for now since changing Message breaks everything
self._messages.append(Message(msg_id, line, node, args, confidence))
@staticmethod
def is_message_enabled(*unused_args, **unused_kwargs):
return True
def add_stats(self, **kwargs):
for name, value in kwargs.items():
self.stats[name] = value
return self.stats
@property
def options_providers(self):
return linter.options_providers