Skip to content
Snippets Groups Projects
Commit e7eb67eab53f authored by Gregory Szorc's avatar Gregory Szorc
Browse files

tests: write out file using bytes I/O

The encoding of sys.stdout varies between Python versions. So
using a one-liner to write a file from a Unicode string is not
deterministic.

This commit writes out the file using bytes I/O to ensure we
have exactly the bytes we want in the file.

This change fixes a test failure in Python 3.5/3.6.

Differential Revision: https://phab.mercurial-scm.org/D7226
parent a8454e846736
No related branches found
No related tags found
No related merge requests found
......@@ -966,7 +966,9 @@
$ cd ..
$ hg init eucjp
$ cd eucjp
$ "$PYTHON" -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo"
>>> with open('eucjp.txt', 'wb') as fh:
... # Japanese kanji "Kyo"
... fh.write(u'\265\376'.encode('utf-8')) and None
$ hg ci -Ama
adding eucjp.txt
$ hgserveget () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment