Patchwork D8348: tests: force newlines to LF in inline Python script

login
register
mail settings
Submitter phabricator
Date March 30, 2020, 1:30 a.m.
Message ID <differential-rev-PHID-DREV-wpea6xvkkfgvsddkux47-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45947/
State New
Headers show

Comments

phabricator - March 30, 2020, 1:30 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Like we've done in what seems like an infinite stream of random
  scripts, we need to set sys.stdout to normalize to LF on
  Python 3 on Windows or else CRLF can creep in.
  
  With this change, test-fix.t now passes on Python 3 on Windows.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-fix.t

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - April 17, 2020, 6:30 p.m.
marmoute added a comment.
marmoute accepted this revision.


  looks legit.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8348/new/

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

To: indygreg, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
phabricator - April 17, 2020, 6:34 p.m.
marmoute added a comment.
marmoute added a subscriber: mharbison72.
marmoute resigned from this revision.


  actually @mharbison72 comment on D8345 <https://phab.mercurial-scm.org/D8345> make me reconsider. Please allign the status of this with the status of D8345 <https://phab.mercurial-scm.org/D8345>.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8348/new/

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

To: indygreg, #hg-reviewers
Cc: mharbison72, marmoute, mercurial-devel

Patch

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -3,10 +3,19 @@ 
 
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY <<EOF
+  > import io
   > import sys
   > from mercurial.utils.procutil import setbinary
   > setbinary(sys.stdin)
   > setbinary(sys.stdout)
+  > if sys.version_info[0] >= 3:
+  >     sys.stdout = io.TextIOWrapper(
+  >         sys.stdout.buffer,
+  >         sys.stdout.encoding,
+  >         sys.stdout.errors,
+  >         newline="\n",
+  >         line_buffering=sys.stdout.line_buffering,
+  >     )
   > lines = set()
   > for arg in sys.argv[1:]:
   >   if arg == 'all':