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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri Dec 29 00:48:26 UTC 2017


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

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



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


More information about the Mercurial-devel mailing list