tests/unwrap-message-id.py
author Denis Laxalde <denis@laxalde.org>
Sun, 27 Oct 2019 18:12:24 +0100
branchstable
changeset 43334 4128ffba4431
child 44405 a1908951ca42
permissions -rw-r--r--
tests: handle Message-Id email header possible wrapping The "Message-Id" header will get wrapped with a new line when exceeding 75 characters on Python 3 (see changeset 7d4f2e4899c5 introducing usage of email.header.Header.encode and respective doc). This will occur in an unpredictable manner depending on the hostname's length. To make the test output consistent across Python versions and hostname configuration, we add a filter to unwrap this header value.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43334
4128ffba4431 tests: handle Message-Id email header possible wrapping
Denis Laxalde <denis@laxalde.org>
parents:
diff changeset
     1
from __future__ import absolute_import, print_function
4128ffba4431 tests: handle Message-Id email header possible wrapping
Denis Laxalde <denis@laxalde.org>
parents:
diff changeset
     2
4128ffba4431 tests: handle Message-Id email header possible wrapping
Denis Laxalde <denis@laxalde.org>
parents:
diff changeset
     3
import re
4128ffba4431 tests: handle Message-Id email header possible wrapping
Denis Laxalde <denis@laxalde.org>
parents:
diff changeset
     4
import sys
4128ffba4431 tests: handle Message-Id email header possible wrapping
Denis Laxalde <denis@laxalde.org>
parents:
diff changeset
     5
4128ffba4431 tests: handle Message-Id email header possible wrapping
Denis Laxalde <denis@laxalde.org>
parents:
diff changeset
     6
print(re.sub(r"(?<=Message-Id:) \n ", " ", sys.stdin.read()), end="")