Commit a9f59136 authored by Joe Guo's avatar Joe Guo Committed by Douglas Bagnall

selftest: enable py3 for samba.tests.docs

Popen methods will return bytes.
Decode output to string before using.
Signed-off-by: default avatarJoe Guo <joeg@catalyst.net.nz>
Reviewed-by: default avatarAndrew Bartlett <abartlet@samba.org>
Reviewed-by: default avatarDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
parent c0706803
......@@ -197,10 +197,11 @@ class SmbDotConfTests(TestCase):
p = subprocess.Popen(program + ["-s", self.smbconf,
"--section-name", section, "--parameter-name", param],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.topdir).communicate()
if p[0].upper().strip() != default.upper():
if not (p[0].upper().strip() == "" and default == '""'):
result = p[0].decode().upper().strip()
if result != default.upper():
if not (result == "" and default == '""'):
doc_triple = "%s\n Expected: %s" % (param, default)
failset.add("%s\n Got: %s" % (doc_triple, p[0].upper().strip()))
failset.add("%s\n Got: %s" % (doc_triple, result))
if len(failset) > 0:
self.fail(self._format_message(failset,
......@@ -227,10 +228,11 @@ class SmbDotConfTests(TestCase):
"--section-name", section, "--parameter-name", param,
"--option", "%s = %s" % (param, default)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.topdir).communicate()
if p[0].upper().strip() != default.upper():
if not (p[0].upper().strip() == "" and default == '""'):
result = p[0].decode().upper().strip()
if result != default.upper():
if not (result == "" and default == '""'):
doc_triple = "%s\n Expected: %s" % (param, default)
failset.add("%s\n Got: %s" % (doc_triple, p[0].upper().strip()))
failset.add("%s\n Got: %s" % (doc_triple, result))
if len(failset) > 0:
self.fail(self._format_message(failset,
......@@ -285,10 +287,11 @@ class SmbDotConfTests(TestCase):
"--section-name", section, "--parameter-name", param,
"--option", "%s = %s" % (param, value_to_use)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.topdir).communicate()
if p[0].upper().strip() != value_to_use.upper():
result = p[0].decode().upper().strip()
if result != value_to_use.upper():
# currently no way to distinguish command lists
if param_type == 'list':
if ", ".join(p[0].upper().strip().split()) == value_to_use.upper():
if ", ".join(result.split()) == value_to_use.upper():
continue
# currently no way to identify octal
......@@ -320,7 +323,7 @@ class SmbDotConfTests(TestCase):
# testparm doesn't display a value if they are equivalent
if (value_to_use.lower() != opposite_value.lower()):
for line in p[0].splitlines():
for line in p[0].decode().splitlines():
if not line.strip().startswith(param):
continue
......@@ -352,7 +355,7 @@ class SmbDotConfTests(TestCase):
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.topdir).communicate()
output = ""
for line in p[0].splitlines():
for line in p[0].decode().splitlines():
if line.strip().startswith('#'):
continue
if line.strip().startswith("idmap config *"):
......
......@@ -43,7 +43,7 @@ pam_wrapper_so_path=config_hash["LIBPAM_WRAPPER_SO_PATH"]
planpythontestsuite("none", "samba.tests.source", py3_compatible=True)
if have_man_pages_support:
planpythontestsuite("none", "samba.tests.docs")
planpythontestsuite("none", "samba.tests.docs", py3_compatible=True)
try:
import testscenarios
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment