Patchwork D2126: py3: replace file() with open() in test-import-bypass.t

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 12:41 p.m.
Message ID <differential-rev-PHID-DREV-gnvxbpmeicqydlkpuluh-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27541/
State Superseded
Headers show

Comments

phabricator - Feb. 11, 2018, 12:41 p.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.
  This patch also adds a b'' prefix to make sure we write bytes in Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-import-bypass.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-import-bypass.t b/tests/test-import-bypass.t
--- a/tests/test-import-bypass.t
+++ b/tests/test-import-bypass.t
@@ -227,7 +227,7 @@ 
 (this also tests that editor is not invoked for '--bypass', if the
 commit message is explicitly specified, regardless of '--edit')
 
-  $ $PYTHON -c 'file("a", "wb").write("a\r\n")'
+  $ $PYTHON -c 'open("a", "wb").write(b"a\r\n")'
   $ hg ci -m makeacrlf
   $ HGEDITOR=cat hg import -m 'should fail because of eol' --edit --bypass ../test.diff
   applying ../test.diff