Skip to content

Commit 0eb0ca4

Browse files
committed
test_lib Python 3 str/bytes workaround
This one only seems to be triggered when a test fails.
1 parent 83ec0d8 commit 0eb0ca4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/test_lib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ def RunTestWithInputOutput(cmd, input_data, capture_stderr=True, timeout=None):
237237
cpu_time_consumed = 0
238238
else:
239239
cpu_time_consumed = timer.ElapsedCpuTime(p)
240-
stdout = stdout.decode('utf-8', 'backslashreplace')
241-
stderr = stderr.decode('utf-8', 'backslashreplace')
240+
if not isinstance(stdout, str):
241+
stdout = stdout.decode('utf-8', 'backslashreplace')
242+
stderr = stderr.decode('utf-8', 'backslashreplace')
242243
return (cpu_time_consumed, retcode, failed, stdout, stderr)
243244

244245

0 commit comments

Comments
 (0)