diff options
author | Luke Diamand <luke@diamand.org> | 2016-04-26 07:51:00 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-26 17:48:13 (GMT) |
commit | 84096814a82eeb9c23bfc2b8ad7709d2c616b07d (patch) | |
tree | 5e321280207fac88b9d3b7d532985844a1c51c15 /t/lib-git-p4.sh | |
parent | d1deaf4d02065fd8a1ace538df22a2125cf0b994 (diff) | |
download | git-84096814a82eeb9c23bfc2b8ad7709d2c616b07d.zip git-84096814a82eeb9c23bfc2b8ad7709d2c616b07d.tar.gz git-84096814a82eeb9c23bfc2b8ad7709d2c616b07d.tar.bz2 |
git-p4 tests: work with python3 as well as python2
Update the git-p4 tests so that they work with both
Python2 and Python3.
We have to be explicit about the difference between
Unicode text strings (Python3 default) and raw binary
strings which will be exchanged with Perforce.
Additionally, print always takes parentheses in Python3.
Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-git-p4.sh')
-rw-r--r-- | t/lib-git-p4.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh index 724bc43..7393ee2 100644 --- a/t/lib-git-p4.sh +++ b/t/lib-git-p4.sh @@ -198,9 +198,10 @@ marshal_dump() { cat >"$TRASH_DIRECTORY/marshal-dump.py" <<-EOF && import marshal import sys + instream = getattr(sys.stdin, 'buffer', sys.stdin) for i in range($line): - d = marshal.load(sys.stdin) - print d['$what'] + d = marshal.load(instream) + print(d[b'$what'].decode('utf-8')) EOF "$PYTHON_PATH" "$TRASH_DIRECTORY/marshal-dump.py" } |