X7ROOT File Manager
Current Path:
/opt/cloudlinux/venv/lib/python3.11/site-packages/pylint/testutils
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
pylint
/
testutils
/
ðŸ“
..
📄
__init__.py
(1.28 KB)
ðŸ“
__pycache__
ðŸ“
_primer
📄
_run.py
(1.51 KB)
📄
checker_test_case.py
(4.27 KB)
📄
configuration_test.py
(5.89 KB)
📄
constants.py
(1.12 KB)
📄
decorator.py
(1.22 KB)
ðŸ“
functional
📄
functional_test_file.py
(635 B)
📄
get_test_info.py
(2.08 KB)
📄
global_test_linter.py
(685 B)
📄
lint_module_test.py
(12.5 KB)
📄
output_line.py
(5.76 KB)
📄
pyreverse.py
(4.1 KB)
📄
reporter_for_tests.py
(2.25 KB)
📄
testing_pylintrc
(198 B)
📄
tokenize_str.py
(447 B)
📄
unittest_linter.py
(2.73 KB)
📄
utils.py
(3.06 KB)
Editing: reporter_for_tests.py
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE # Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations from io import StringIO from os import getcwd, sep from typing import TYPE_CHECKING from pylint.message import Message from pylint.reporters import BaseReporter if TYPE_CHECKING: from pylint.reporters.ureports.nodes import Section class GenericTestReporter(BaseReporter): """Reporter storing plain text messages.""" out: StringIO def __init__( # pylint: disable=super-init-not-called # See https://github.com/PyCQA/pylint/issues/4941 self, ) -> None: self.path_strip_prefix: str = getcwd() + sep self.reset() def reset(self) -> None: self.out = StringIO() self.messages: list[Message] = [] def handle_message(self, msg: Message) -> None: """Append messages to the list of messages of the reporter.""" self.messages.append(msg) def finalize(self) -> str: """Format and print messages in the context of the path.""" messages: list[str] = [] for msg in self.messages: obj = "" if msg.obj: obj = f":{msg.obj}" messages.append(f"{msg.msg_id[0]}:{msg.line:>3}{obj}: {msg.msg}") messages.sort() for message in messages: print(message, file=self.out) result = self.out.getvalue() self.reset() return result def on_set_current_module(self, module: str, filepath: str | None) -> None: pass # pylint: enable=unused-argument def display_reports(self, layout: Section) -> None: """Ignore layouts.""" def _display(self, layout: Section) -> None: pass class MinimalTestReporter(BaseReporter): def on_set_current_module(self, module: str, filepath: str | None) -> None: self.messages = [] def _display(self, layout: Section) -> None: pass class FunctionalTestReporter(BaseReporter): def display_reports(self, layout: Section) -> None: """Ignore layouts and don't call self._display().""" def _display(self, layout: Section) -> None: pass
Upload File
Create Folder