Patchwork D2111: py3: replace file() with open() in test-convert-mtn.t

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 12:39 p.m.
Message ID <differential-rev-PHID-DREV-a4j2jkxtobq3dbhakuxq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27526/
State Superseded
Headers show

Comments

phabricator - Feb. 11, 2018, 12:39 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While I was here, I added b'' prefixes to make sure we write things correctly in
  bytes mode on Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2111

AFFECTED FILES
  tests/test-convert-mtn.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-convert-mtn.t b/tests/test-convert-mtn.t
--- a/tests/test-convert-mtn.t
+++ b/tests/test-convert-mtn.t
@@ -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