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

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 12:42 p.m.
Message ID <differential-rev-PHID-DREV-vxxrj3zyfw7zmtp6lckx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27545/
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/D2130

AFFECTED FILES
  tests/test-encoding.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 an encoding issue.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -15,9 +15,9 @@ 
   $ hg co
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ $PYTHON << EOF
-  > f = file('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close()
-  > f = file('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close()
-  > f = file('latin-1-tag', 'w'); f.write("\xe9"); f.close()
+  > f = open('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close()
+  > f = open('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close()
+  > f = open('latin-1-tag', 'w'); f.write("\xe9"); f.close()
   > EOF
 
 should fail with encoding error