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',
'testsuite-success', 'testsuite-error',
'uxsuccess', 'testsuite-uxsuccess'])
+
class TestsuiteEnabledTestResult(unittest.TestResult):
def start_testsuite(self, name):
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
out = ""
unexpected = False
- if not name in self.test_output:
+ if name not in self.test_output:
print("no output for name[%s]" % name)
if result in ("success", "xfail"):
'success': '.'}.get(result, "?(%s)" % result))
return
- if not self.name in self.test_output:
+ if self.name not in self.test_output:
self.test_output[self.name] = ""
self.test_output[self.name] += "UNEXPECTED(%s): %s\n" % (result, testname)