From 5b1936d78b943a2ac71a583265dd2e835882b36c Mon Sep 17 00:00:00 2001 From: i-keliukh <46344924+i-keliukh@users.noreply.github.com> Date: Fri, 19 Aug 2022 11:26:15 +0300 Subject: [PATCH] fix(test): failure in PyCharm on Ubuntu 22 The failure is caused by colorama package producing excessive output at the process termination. The additional output leads to error when parsing json. Details: 1. https://github.com/PyCQA/isort/issues/1657 2. https://github.com/tartley/colorama/issues/307 --- universum/analyzers/pylint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/universum/analyzers/pylint.py b/universum/analyzers/pylint.py index f601696e..7b383f89 100644 --- a/universum/analyzers/pylint.py +++ b/universum/analyzers/pylint.py @@ -26,6 +26,11 @@ def main(settings: argparse.Namespace) -> List[utils.ReportData]: def pylint_output_parser(output: str) -> List[utils.ReportData]: result: List[utils.ReportData] = [] + # Workaround for colorama polluting the process output when run from PyCharm - remove the trailing color reset + # escape sequence. Details: + # 1. https://github.com/PyCQA/isort/issues/1657 + # 2. https://github.com/tartley/colorama/issues/307 + output = output[:output.rfind(']') + 1] for data in json.loads(output): # pylint has its own escape rules for json output of "message" values. # it uses cgi.escape lib and escapes symbols <>&