Skip to content

Commit 1afd859

Browse files
authored
Merge pull request #13 from jmespath/py3
Update jp-compliance to run on python3
2 parents cf31049 + 4bc4b9c commit 1afd859

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bin/jp-compliance

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ class ComplianceTestRunner(object):
137137
process = subprocess.Popen(command, stdout=subprocess.PIPE,
138138
stderr=subprocess.PIPE,
139139
stdin=subprocess.PIPE)
140-
except Exception, e:
140+
except Exception as e:
141141
raise RuntimeError('Could not execute test executable "%s": '
142142
'%s' % (' '.join(command), e))
143-
process.stdin.write(json.dumps(test_case['given']))
143+
process.stdin.write(json.dumps(test_case['given']).encode('utf-8'))
144144
process.stdin.flush()
145145
stdout, stderr = process.communicate()
146+
stdout = stdout.decode('utf-8')
147+
stderr = stderr.decode('utf-8')
146148
if 'result' in test_case:
147149
try:
148150
actual = json.loads(stdout)
@@ -271,7 +273,7 @@ def main():
271273
else:
272274
try:
273275
runner.run_tests(args.stop_first_fail)
274-
except Exception, e:
276+
except Exception as e:
275277
sys.stderr.write(str(e))
276278
sys.stderr.write("\n")
277279
return 1

0 commit comments

Comments
 (0)