From af1d2f0f9b448ab0587c97f82ea3b08778cfe781 Mon Sep 17 00:00:00 2001 From: Artur Spirin Date: Sat, 19 Aug 2023 09:26:05 -0700 Subject: [PATCH] Fix for encode/decode in present_console_output Change-Id: Ifdc1c4aa2f9a9cadf9b813d5b67af2ebf4e04892 --- setup.py | 3 ++- test_junkie/metrics.py | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index c09db50..9821051 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setuptools.setup( name="test_junkie", - version="0.8a7", + version="0.8a8", author="Artur Spirin", author_email="as.no.replies@gmail.com", description="Modern Testing Framework", @@ -24,6 +24,7 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Topic :: Software Development :: Quality Assurance", diff --git a/test_junkie/metrics.py b/test_junkie/metrics.py index e8774ad..3ef9a1f 100644 --- a/test_junkie/metrics.py +++ b/test_junkie/metrics.py @@ -331,13 +331,22 @@ def parse_exception(value): for index in range(param_data["retry"]): trace = param_data["tracebacks"][index] if trace is not None: - trace = ":: Traceback: {}".format( - CliUtils.format_color_string( - parse_exception( - trace.encode('utf8', errors="replace").decode("unicode-escape") - ), "red" + try: + trace = ":: Traceback: {}".format( + CliUtils.format_color_string( + parse_exception( + trace.encode('utf8', errors="replace") + ), "red" + ) + ) + except: + trace = ":: Traceback: {}".format( + CliUtils.format_color_string( + parse_exception( + trace.encode("unicode_escape").decode("utf8") + ), "red" + ) ) - ) else: trace = "" print("\t |__ run #{num} [{status}] [{runtime:0.2f}s] {trace}" @@ -346,9 +355,9 @@ def parse_exception(value): runtime=param_data["performance"][index], status=param_data["statuses"][index].upper())) print("\n===========================================================") - print(". Test Junkie {} (Python{}) {} .".format(pkg_resources.require("test-junkie")[0].version, - sys.version_info[0], - DocumentationLinks.DOMAIN)) + print(". Test Junkie {} (Python{}) {} .".format( + pkg_resources.require("test-junkie")[0].version, sys.version_info[0], DocumentationLinks.DOMAIN) + ) print("===========================================================") @staticmethod