summaryrefslogtreecommitdiff
path: root/t/lib-git-p4.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-06 21:45:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-05-06 21:45:42 (GMT)
commitca158f4633e40fb8a6e7e6b78dc7ad559718a19b (patch)
treee1ad86c75391478273f05cbc2e09c16b2857358c /t/lib-git-p4.sh
parent3b577581abdf9ad5a177cfce9e23dba411a6f1ae (diff)
parent1fb3fb4e6d4709a3b8311deff4b109af67efb514 (diff)
downloadgit-ca158f4633e40fb8a6e7e6b78dc7ad559718a19b.zip
git-ca158f4633e40fb8a6e7e6b78dc7ad559718a19b.tar.gz
git-ca158f4633e40fb8a6e7e6b78dc7ad559718a19b.tar.bz2
Merge branch 'ld/p4-test-py3'
The test scripts for "git p4" (but not "git p4" implementation itself) has been updated so that they would work even on a system where the installed version of Python is python 3. * ld/p4-test-py3: git-p4 tests: time_in_seconds should use $PYTHON_PATH git-p4 tests: work with python3 as well as python2 git-p4 tests: cd to / before running python
Diffstat (limited to 't/lib-git-p4.sh')
-rw-r--r--t/lib-git-p4.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index ce3536e..54fd5a6 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -50,7 +50,7 @@ native_path () {
# at runtime (e.g. via NTP). The 'clock_gettime(CLOCK_MONOTONIC)'
# function could fix that but it is not in Python until 3.3.
time_in_seconds () {
- python -c 'import time; print int(time.time())'
+ (cd / && "$PYTHON_PATH" -c 'import time; print(int(time.time()))')
}
# Try to pick a unique port: guess a large number, then hope
@@ -207,9 +207,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"
}