Patchwork D2131: py3: replace file() with open() in test-encoding-align.t

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

Comments

phabricator - Feb. 11, 2018, 12:42 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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-encoding-align.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 11, 2018, 2:06 p.m.
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  Perhaps these open()s need 'b' because we're testing non-ascii strings.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/tests/test-encoding-align.t b/tests/test-encoding-align.t
--- a/tests/test-encoding-align.t
+++ b/tests/test-encoding-align.t
@@ -11,11 +11,11 @@ 
   > m = "MIDDLE_"
   > # (byte, width) = (18, 12)
   > l = "\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d"
-  > f = file('s', 'w'); f.write(s); f.close()
-  > f = file('m', 'w'); f.write(m); f.close()
-  > f = file('l', 'w'); f.write(l); f.close()
+  > f = open('s', 'w'); f.write(s); f.close()
+  > f = open('m', 'w'); f.write(m); f.close()
+  > f = open('l', 'w'); f.write(l); f.close()
   > # instant extension to show list of options
-  > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8
+  > f = open('showoptlist.py', 'w'); f.write("""# encoding: utf-8
   > from mercurial import registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)