[PATCH 3 of 3 STABLE v2] py3: fix generated non-ascii message in test-notify.t

Denis Laxalde denis at laxalde.org
Fri Oct 25 08:53:55 EDT 2019


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1571930937 -7200
#      Thu Oct 24 17:28:57 2019 +0200
# Branch stable
# Node ID cbd5e40989fa40f9f5ef63e2fae738937ac87e22
# Parent  5da37487d2dbd296d1ffa79d9b99a1b4ab077335
py3: fix generated non-ascii message in test-notify.t

The resulting "Subject:" header contains an encoded word in Python 3 so
we have to add distinct outputs for Python 3 but underlying values are
the same:

    >>> from email.header import decode_header
    >>> decode_header('=?utf-8?b?w6AuLi4=?=')
    [(b'\xc3\xa0...', 'utf-8')]

diff --git a/tests/test-notify.t b/tests/test-notify.t
--- a/tests/test-notify.t
+++ b/tests/test-notify.t
@@ -419,7 +419,7 @@ non-ascii content and truncation of mult
   > EOF
   $ echo a >> a/a
   $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
-  >   -m `"$PYTHON" -c 'print("\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4")'`
+  >   -m `"$PYTHON" -c 'import sys; getattr(sys.stdout, "buffer", sys.stdout).write(b"\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4")'`
   $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
   >   "$PYTHON" $TESTTMP/filter.py
   pulling from ../a
@@ -434,7 +434,8 @@ non-ascii content and truncation of mult
   Content-Transfer-Encoding: 8bit
   X-Test: foo
   Date: * (glob)
-  Subject: \xc3\xa0... (esc)
+  Subject: \xc3\xa0... (esc) (no-py3 !)
+  Subject: =?utf-8?b?w6AuLi4=?= (py3 !)
   From: test at test.com
   X-Hg-Notification: changeset 0f25f9c22b4c
   Message-Id: <*> (glob)


More information about the Mercurial-devel mailing list