changeset 36260:9a1df91429af

py3: replace file() with open() in test-convert-git.t file() is not present in Python 3. It also makes sure we write bytes on Python 3. Differential Revision: https://phab.mercurial-scm.org/D2133
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 11 Feb 2018 17:17:56 +0530
parents 2892c1d47f30
children c69e78ef2b54
files tests/test-convert-git.t
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-convert-git.t	Thu Feb 15 12:45:46 2018 +0530
+++ b/tests/test-convert-git.t	Sun Feb 11 17:17:56 2018 +0530
@@ -420,7 +420,7 @@
   $ mkdir git-repo3
   $ cd git-repo3
   $ git init-db >/dev/null 2>/dev/null
-  $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
+  $ $PYTHON -c 'import struct; open("b", "wb").write(b"".join([struct.Struct(">B").pack(i) for i in range(256)])*16)'
   $ git add b
   $ commit -a -m addbinary
   $ cd ..
@@ -437,7 +437,7 @@
   $ cd git-repo3-hg
   $ hg up -C
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ $PYTHON -c 'print len(file("b", "rb").read())'
+  $ $PYTHON -c 'print len(open("b", "rb").read())'
   4096
   $ cd ..