Mercurial > hg-stable
changeset 41475:c67f55b02f02
tests: write commit message using file I/O
Python 2.7 will print() \x94\x5c\x0a whereas Python 3 will
print() \xc2\x94\x5c\x0a. Why, I'm not sure. It probably has to
do with print() being Unicode aware on Python 3 and Python
attempting some kind of encoding before emitting the output.
This difference results in a different bytes making it to the
commit message and the JSON output varying. We work around
this by writing bytes to a commit message file.
Differential Revision: https://phab.mercurial-scm.org/D5741
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 29 Jan 2019 11:51:19 -0800 |
parents | d1d3094b54f9 |
children | 9b2b8794f801 |
files | tests/test-hgweb-json.t |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-hgweb-json.t Mon Jan 28 18:00:14 2019 -0800 +++ b/tests/test-hgweb-json.t Tue Jan 29 11:51:19 2019 -0800 @@ -2196,7 +2196,8 @@ Commit message with Japanese Kanji 'Noh', which ends with '\x5c' $ echo foo >> da/foo - $ HGENCODING=cp932 hg ci -m `"$PYTHON" -c 'print("\x94\x5c")'` + >>> open('msg', 'wb').write(b'\x94\x5c\x0a') and None + $ HGENCODING=cp932 hg ci -l msg Commit message with null character