changeset 36012:233fb0b91a35

py3: replace file() with open() in test-convert-mtn.t While I was here, I added b'' prefixes to make sure we write things correctly in bytes mode on Python 3. Differential Revision: https://phab.mercurial-scm.org/D2111
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 11 Feb 2018 17:30:42 +0530
parents c02200b11c39
children 42542adb8944
files tests/test-convert-mtn.t
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-convert-mtn.t	Sun Feb 11 17:30:21 2018 +0530
+++ b/tests/test-convert-mtn.t	Sun Feb 11 17:30:42 2018 +0530
@@ -43,7 +43,7 @@
   $ mkdir dir
   $ echo b > dir/b
   $ echo d > dir/d
-  $ $PYTHON -c 'file("bin", "wb").write("a\\x00b")'
+  $ $PYTHON -c 'open("bin", "wb").write(b"a\\x00b")'
   $ echo c > c
   $ mtn add a dir/b dir/d c bin
   mtn: adding 'a' to workspace manifest
@@ -65,7 +65,7 @@
   $ echo b >> dir/b
   $ mtn drop c
   mtn: dropping 'c' from workspace manifest
-  $ $PYTHON -c 'file("bin", "wb").write("b\\x00c")'
+  $ $PYTHON -c 'open("bin", "wb").write(b"b\\x00c")'
   $ mtn ci -m update1
   mtn: beginning commit on branch 'com.selenic.test'
   mtn: committed revision 51d0a982464573a2a2cf5ee2c9219c652aaebeff
@@ -217,8 +217,8 @@
 
 test large file support (> 32kB)
 
-  >>> fp = file('large-file', 'wb')
-  >>> for x in xrange(10000): fp.write('%d\n' % x)
+  >>> fp = open('large-file', 'wb')
+  >>> for x in xrange(10000): fp.write(b'%d\n' % x)
   >>> fp.close()
   $ md5sum.py large-file
   5d6de8a95c3b6bf9e0ffb808ba5299c1  large-file