1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-28 11:42:03 +03:00

python: samba.subunit.run: Fix Python 3 compatibility.

Usage of function _test_id() which generates test id in bytes breaks
Python 3 compatibility. After fix, this function is not used any more.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Lumir Balhar
2016-10-19 13:32:59 +02:00
committed by Andrew Bartlett
parent 8f8b0fd12a
commit 1e27111955

View File

@ -129,7 +129,7 @@ class TestProtocolClient(unittest.TestResult):
:param error_permitted: If True then error must be supplied.
If False then error must not be supplied.
"""
self._stream.write(("%s: " % outcome) + self._test_id(test))
self._stream.write(("%s: " % outcome) + test.id())
if error_permitted:
if error is None:
raise ValueError
@ -162,16 +162,10 @@ class TestProtocolClient(unittest.TestResult):
"""
self._addOutcome("uxsuccess", test, error_permitted=False)
def _test_id(self, test):
result = test.id()
if type(result) is not bytes:
result = result.encode('utf8')
return result
def startTest(self, test):
"""Mark a test as starting its test run."""
super(TestProtocolClient, self).startTest(test)
self._stream.write("test: " + self._test_id(test) + "\n")
self._stream.write("test: " + test.id() + "\n")
self._stream.flush()
def stopTest(self, test):