# HG changeset patch # User Gregory Szorc # Date 2019-01-29 19:51:19 # Node ID c67f55b02f0248decfad9662a44e5991146d88cb # Parent d1d3094b54f96ae806303d98b69cf7fa32fa2486 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 diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -2196,7 +2196,8 @@ Error page shouldn't crash 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