Patchwork D2360: py3: make sure we open file in bytes mode

login
register
mail settings
Submitter phabricator
Date Feb. 21, 2018, 8:55 a.m.
Message ID <differential-rev-PHID-DREV-5izgabcgyaay4mbopw4d-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28179/
State Superseded
Headers show

Comments

phabricator - Feb. 21, 2018, 8:55 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame because we appended only b'' which stands for bytes

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-ui-color.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 21, 2018, 12:42 p.m.
yuja added a comment.


  > skip-blame because we appended only b'' which stands for bytes
  
  Untrue. :) Dropped this comment in flight.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/tests/test-ui-color.py b/tests/test-ui-color.py
--- a/tests/test-ui-color.py
+++ b/tests/test-ui-color.py
@@ -15,16 +15,16 @@ 
 print(repr(testui.popbuffer()))
 
 # test dispatch.dispatch with the same ui object
-hgrc = open(os.environ["HGRCPATH"], 'w')
+hgrc = open(os.environ["HGRCPATH"], 'wb')
 hgrc.write(b'[extensions]\n')
 hgrc.write(b'color=\n')
 hgrc.close()
 
 ui_ = uimod.ui.load()
 ui_.setconfig(b'ui', b'formatted', b'True')
 
 # we're not interested in the output, so write that to devnull
-ui_.fout = open(os.devnull, 'w')
+ui_.fout = open(os.devnull, 'wb')
 
 # call some arbitrary command just so we go through
 # color's wrapped _runcommand twice.