From: Noel Power Date: Sat, 4 Aug 2018 13:23:28 +0000 (+0100) Subject: PY3: Only decode when necessary X-Git-Tag: tdb-1.3.17~1252 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ade47b3df0a173743ed4ff0633e8544f08774253;p=thirdparty%2Fsamba.git PY3: Only decode when necessary --- diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index d79bd7f2ba5..651d9b00289 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -26,6 +26,8 @@ from samba import subunit from samba.subunit.run import TestProtocolClient from samba.subunit import iso8601 import unittest +from samba.compat import binary_type + VALID_RESULTS = set(['success', 'successful', 'failure', 'fail', 'skip', 'knownfail', 'error', 'xfail', 'skip-testsuite', @@ -91,7 +93,10 @@ def parse_results(msg_ops, statistics, fh): else: reason += l - remote_error = subunit.RemoteError(reason.decode("utf-8")) + if isinstance(reason, binary_type): + remote_error = subunit.RemoteError(reason.decode("utf-8")) + else: + remote_error = subunit.RemoteError(reason) if not terminated: statistics['TESTS_ERROR'] += 1