changeset 36051:035af48b2903

py3: replace file() with open() in test-encoding.t file() is not present in Python 3. This also makes sure we write things in bytes mode in Python 3. Differential Revision: https://phab.mercurial-scm.org/D2130
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 11 Feb 2018 17:14:59 +0530
parents c4fa47f880d3
children af9cb761b5f3
files tests/test-encoding.t
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-encoding.t	Sun Feb 11 16:17:17 2018 +0530
+++ b/tests/test-encoding.t	Sun Feb 11 17:14:59 2018 +0530
@@ -15,9 +15,9 @@
   $ hg co
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ $PYTHON << EOF
-  > f = file('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close()
-  > f = file('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close()
-  > f = file('latin-1-tag', 'w'); f.write("\xe9"); f.close()
+  > f = open('latin-1', 'wb'); f.write(b"latin-1 e' encoded: \xe9"); f.close()
+  > f = open('utf-8', 'wb'); f.write(b"utf-8 e' encoded: \xc3\xa9"); f.close()
+  > f = open('latin-1-tag', 'wb'); f.write(b"\xe9"); f.close()
   > EOF
 
 should fail with encoding error