From: Joe Guo Date: Fri, 23 Mar 2018 01:10:28 +0000 (+1300) Subject: selftest: enable py3 for samba.tests.blackbox.check_output X-Git-Tag: talloc-2.1.13~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=908ee2d3d290148403b560fb8cf3a4128cbd2ec8;p=thirdparty%2Fsamba.git selftest: enable py3 for samba.tests.blackbox.check_output convert bytes to str for Python 3 `BlackboxTestCase.check_output` will return bytes since it uses `subprocess.communicate` underneath. Convert expected string result to bytes for comparing. Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/blackbox/check_output.py b/python/samba/tests/blackbox/check_output.py index d7e41a838b4..8b3643d492d 100644 --- a/python/samba/tests/blackbox/check_output.py +++ b/python/samba/tests/blackbox/check_output.py @@ -100,6 +100,8 @@ class CheckOutputTests(BlackboxTestCase): try: with TimeoutHelper(10): actual = self.check_output(cmdline) - self.assertEqual(actual, expected) + # check_output will return bytes + # convert expected to bytes for python 3 + self.assertEqual(actual, expected.encode('utf-8')) except TimeoutHelper.Timeout: self.fail(msg='Timeout!') diff --git a/selftest/tests.py b/selftest/tests.py index d930373d8b1..4cb6e23446c 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -52,7 +52,7 @@ except ImportError: else: planpythontestsuite("none", "subunit.tests.test_suite") planpythontestsuite("none", "samba.tests.blackbox.ndrdump") -planpythontestsuite("none", "samba.tests.blackbox.check_output") +planpythontestsuite("none", "samba.tests.blackbox.check_output", py3_compatible=True) planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python']) planpythontestsuite("none", "samba.tests.credentials", py3_compatible=True) planpythontestsuite("none", "samba.tests.registry", py3_compatible=True)