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

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 2:05 p.m.
Message ID <5e1651855ae8132496c8ac760ce19898@localhost.localdomain>
Download mbox | patch
Permalink /patch/27565/
State Not Applicable
Headers show

Comments

phabricator - Feb. 11, 2018, 2:05 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2a81ed6c3bb9: py3: replace file() with open() in test-import.t (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2123?vs=5386&id=5412

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

AFFECTED FILES
  tests/test-import.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -56,7 +56,7 @@ 
   $ cat > dummypatch.py <<EOF
   > from __future__ import print_function
   > print('patching file a')
-  > file('a', 'wb').write('line2\n')
+  > open('a', 'wb').write(b'line2\n')
   > EOF
   $ hg clone -r0 a b
   adding changesets
@@ -291,7 +291,7 @@ 
   > msg.set_payload('email commit message\n' + patch)
   > msg['Subject'] = 'email patch'
   > msg['From'] = 'email patcher'
-  > file(sys.argv[2], 'wb').write(msg.as_string())
+  > open(sys.argv[2], 'wb').write(msg.as_string())
   > EOF
 
 
@@ -389,7 +389,7 @@ 
   > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
   > msg['Subject'] = '[PATCH] email patch'
   > msg['From'] = 'email patcher'
-  > file(sys.argv[2], 'wb').write(msg.as_string())
+  > open(sys.argv[2], 'wb').write(msg.as_string())
   > EOF
 
 
@@ -829,7 +829,7 @@ 
   $ hg init binaryremoval
   $ cd binaryremoval
   $ echo a > a
-  $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
+  $ $PYTHON -c "open('b', 'wb').write(b'a\x00b')"
   $ hg ci -Am addall
   adding a
   adding b