summaryrefslogtreecommitdiff
path: root/test/cmark.py
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-27 14:39:47 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-29 16:42:26 -0800
commitd1922eb6f17578774866a13fd5428cdd3bc2280d (patch)
tree530dfbde51bbb7a82c85d14cc593e631c7628021 /test/cmark.py
parent4a7d305d220a4081ac7c106199baa940d838ce67 (diff)
Updated tests to use python3.
Diffstat (limited to 'test/cmark.py')
-rw-r--r--test/cmark.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/cmark.py b/test/cmark.py
index 432a3e0..21d0b3f 100644
--- a/test/cmark.py
+++ b/test/cmark.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ctypes import CDLL, c_char_p, c_long
@@ -7,11 +7,13 @@ import platform
def pipe_through_prog(prog, text):
p1 = Popen(prog.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE)
- [result, err] = p1.communicate(input=text)
- return [p1.returncode, result, err]
+ [result, err] = p1.communicate(input=text.encode('utf-8'))
+ return [p1.returncode, result.decode('utf-8'), err]
def use_library(lib, text):
- return [0, lib(text, len(text)), '']
+ textbytes = text.encode('utf-8')
+ textlen = len(textbytes)
+ return [0, lib(textbytes, textlen).decode('utf-8'), '']
class CMark:
def __init__(self, prog=None, library_dir=None):