This is an archive of the discontinued Mercurial Phabricator instance.

py3: use sys.stdout instead of print in test-mq-qpush-fail.t
ClosedPublic

Authored by pulkit on Apr 10 2018, 10:15 AM.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Apr 10 2018, 10:15 AM
yuja requested changes to this revision.Apr 10 2018, 11:20 AM
yuja added a subscriber: yuja.

print(nonascii) may fail depending on the locale.
We have to use getattr(sys.stdout, 'buffer', sys.stdout) or pycompat.stdout.

This revision now requires changes to proceed.Apr 10 2018, 11:20 AM
In D3218#51610, @yuja wrote:

print(nonascii) may fail depending on the locale.
We have to use getattr(sys.stdout, 'buffer', sys.stdout) or pycompat.stdout.

I get the following failure:

--- /home/foobar/repo/hg-committed/tests/test-mq-qpush-fail.t
+++ /home/foobar/repo/hg-committed/tests/test-mq-qpush-fail.t.err
@@ -60,7 +60,7 @@
   cleaning up working directory...
   reverting foo
   done
-  abort: decoding near '\xe9': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)
+  abort: decoding near '\xe9From: tes': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)
   [255]
   $ hg parents
   changeset:   0:bbd179dfa0a7

I see that you advised same on D2334 and I got the above failure that time too and was unable to followup. Any ideas on this failure? I tried stdout.flush() too.

yuja added a comment.Apr 11 2018, 7:06 AM

Maybe you didn't add "\n".

pulkit retitled this revision from py3: use print as a function in test-mq-qpush-fail.t to py3: use sys.stdout instead of print in test-mq-qpush-fail.t.Apr 11 2018, 7:21 AM
pulkit updated this revision to Diff 7964.
In D3218#51878, @yuja wrote:

Maybe you didn't add "\n".

Yep, I didn't add "\n". Thanks a lot!

yuja added a comment.Apr 11 2018, 7:49 AM

Queued, thanks. I've dropped unneeded flush(), and added b''.

This revision was automatically updated to reflect the committed changes.