py3: replace file() with open() in test-import-git.t
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 11 Feb 2018 17:09:37 +0530
changeset 36025 32695e525586
parent 36024 2a81ed6c3bb9
child 36026 a4d7e51709e5
py3: replace file() with open() in test-import-git.t file() is not present in Python 3. This patch also adds a b'' prefix to make sure we write bytes in Python 3. Differential Revision: https://phab.mercurial-scm.org/D2124
tests/test-import-git.t
--- a/tests/test-import-git.t	Sun Feb 11 17:08:40 2018 +0530
+++ b/tests/test-import-git.t	Sun Feb 11 17:09:37 2018 +0530
@@ -563,10 +563,10 @@
   > Mc$`b*O5$Pw00T?_*Z=?k
   > 
   > EOF
-  >>> fp = file('binary.diff', 'rb')
+  >>> fp = open('binary.diff', 'rb')
   >>> data = fp.read()
   >>> fp.close()
-  >>> file('binary.diff', 'wb').write(data.replace('\n', '\r\n'))
+  >>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n'))
   $ rm binary2
   $ hg import --no-commit binary.diff
   applying binary.diff