py3: replace file() with open() in test-subrepo-missing.t
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 11 Feb 2018 17:02:14 +0530
changeset 36018 1c322658f43e
parent 36017 eed40f0f4c6f
child 36019 2ea0e89bca1e
py3: replace file() with open() in test-subrepo-missing.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/D2117
tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t	Sun Feb 11 17:01:25 2018 +0530
+++ b/tests/test-subrepo-missing.t	Sun Feb 11 17:02:14 2018 +0530
@@ -14,7 +14,7 @@
 
 ignore blanklines in .hgsubstate
 
-  >>> file('.hgsubstate', 'wb').write('\n\n   \t \n   \n')
+  >>> open('.hgsubstate', 'wb').write(b'\n\n   \t \n   \n')
   $ hg st --subrepos
   M .hgsubstate
   $ hg revert -qC .hgsubstate
@@ -22,7 +22,7 @@
 abort more gracefully on .hgsubstate parsing error
 
   $ cp .hgsubstate .hgsubstate.old
-  >>> file('.hgsubstate', 'wb').write('\ninvalid')
+  >>> open('.hgsubstate', 'wb').write(b'\ninvalid')
   $ hg st --subrepos --cwd $TESTTMP -R $TESTTMP/repo
   abort: invalid subrepository revision specifier in 'repo/.hgsubstate' line 2
   [255]