comparison tests/test-highlight.t @ 43416:e7eb67eab53f stable

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 04 Nov 2019 20:57:31 -0800
parents 9d39671adadb
children 5b38c2ab6ad3
comparison
equal deleted inserted replaced
43415:a8454e846736 43416:e7eb67eab53f
964 964
965 $ cat errors.log 965 $ cat errors.log
966 $ cd .. 966 $ cd ..
967 $ hg init eucjp 967 $ hg init eucjp
968 $ cd eucjp 968 $ cd eucjp
969 $ "$PYTHON" -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo" 969 >>> with open('eucjp.txt', 'wb') as fh:
970 ... # Japanese kanji "Kyo"
971 ... fh.write(u'\265\376'.encode('utf-8')) and None
970 $ hg ci -Ama 972 $ hg ci -Ama
971 adding eucjp.txt 973 adding eucjp.txt
972 $ hgserveget () { 974 $ hgserveget () {
973 > killdaemons.py 975 > killdaemons.py
974 > echo % HGENCODING="$1" hg serve 976 > echo % HGENCODING="$1" hg serve