py3: use bytes and open() instead of file() in test-diff-upgrade.t
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 29 Dec 2017 05:35:57 +0530
changeset 35579 15ddf83fbf84
parent 35578 86f9aabed67b
child 35580 cb0db11f392d
py3: use bytes and open() instead of file() in test-diff-upgrade.t file() is not present in Python 3. Differential Revision: https://phab.mercurial-scm.org/D1789
tests/test-diff-upgrade.t
--- a/tests/test-diff-upgrade.t	Wed Jan 10 11:02:20 2018 -0800
+++ b/tests/test-diff-upgrade.t	Fri Dec 29 05:35:57 2017 +0530
@@ -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