summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-08-04 14:23:28 +0100
committerAndrew Bartlett <abartlet@samba.org>2018-10-23 05:50:25 +0200
commitade47b3df0a173743ed4ff0633e8544f08774253 (patch)
treed34cd9acaf1ed697d19842b6d1b7aaef3e2a2895
parentee595e9b7cea888a978831076e9de3111afccd42 (diff)
downloadsamba-ade47b3df0a173743ed4ff0633e8544f08774253.tar.gz
PY3: Only decode when necessary
-rw-r--r--selftest/subunithelper.py7
1 files changed, 6 insertions, 1 deletions
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