From 1ffe2b3096b6f3d2d03f4eb8320a5727e49838f8 Mon Sep 17 00:00:00 2001 From: Manuel Traut Date: Wed, 20 Sep 2017 08:26:35 +0200 Subject: be more specific about bytes and strings needed to run with python3 Signed-off-by: Manuel Traut --- pyjutest | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyjutest b/pyjutest index 49c71de..3bfd9e3 100755 --- a/pyjutest +++ b/pyjutest @@ -14,7 +14,7 @@ if len (sys.argv) != 2: sys.exit(-1) if os.path.exists('pyjutest.dat'): - with open('pyjutest.dat', 'r') as dat: + with open('pyjutest.dat', 'rb') as dat: tss = load(dat) else: tss = [TestSuite("suite", None)] @@ -22,13 +22,15 @@ else: p = Popen(sys.argv[1], shell=True, stdout=PIPE, stderr=PIPE) out,err = p.communicate() -tc = TestCase(sys.argv[1], 'sh', 2, out[:-1], err[:-1]) +tc = TestCase(sys.argv[1], 'sh', 2, out[:-1].decode('utf-8'), + err[:-1].decode('utf-8')) + if p.returncode: tc.add_failure_info(err, "return: %d" % p.returncode) tss[0].test_cases.append(tc) -with open('pyjutest.dat', 'w') as dat: +with open('pyjutest.dat', 'wb') as dat: dump(tss, dat) with open('pyjutest.xml', 'w') as xml: -- cgit v1.2.3