Patchwork D1789: py3: use bytes and open() instead of file() in test-diff-upgrade.t

login
register
mail settings
Submitter phabricator
Date Dec. 29, 2017, 12:48 a.m.
Message ID <differential-rev-PHID-DREV-rszxtxwf73qb6pwexwrv-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26486/
State Superseded
Headers show

Comments

phabricator - Dec. 29, 2017, 12:48 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  file() is not present in Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-diff-upgrade.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-diff-upgrade.t b/tests/test-diff-upgrade.t
--- a/tests/test-diff-upgrade.t
+++ b/tests/test-diff-upgrade.t
@@ -16,7 +16,7 @@ 
 
   $ echo regular > regular
   $ echo rmregular > rmregular
-  $ $PYTHON -c "file('bintoregular', 'wb').write('\0')"
+  $ $PYTHON -c "open('bintoregular', 'wb').write(b'\0')"
   $ touch rmempty
   $ echo exec > exec
   $ chmod +x exec
@@ -26,7 +26,7 @@ 
   $ echo unsetexec > unsetexec
   $ chmod +x unsetexec
   $ echo binary > binary
-  $ $PYTHON -c "file('rmbinary', 'wb').write('\0')"
+  $ $PYTHON -c "open('rmbinary', 'wb').write(b'\0')"
   $ hg ci -Am addfiles
   adding binary
   adding bintoregular
@@ -50,8 +50,8 @@ 
   $ rm rmexec
   $ chmod +x setexec
   $ chmod -x unsetexec
-  $ $PYTHON -c "file('binary', 'wb').write('\0\0')"
-  $ $PYTHON -c "file('newbinary', 'wb').write('\0')"
+  $ $PYTHON -c "open('binary', 'wb').write(b'\0\0')"
+  $ $PYTHON -c "open('newbinary', 'wb').write(b'\0')"
   $ rm rmbinary
   $ hg addremove -s 0
   adding newbinary