From 5128c252fb794ad805d69bc9c4496cbfaa90a38e Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Mon, 27 Aug 2018 15:37:31 +0200 Subject: [PATCH] bpo-34403: Skip test_utf8_mode.test_cmd_line() on HP-UX Skip this test because it requires a single-byte default locale encoding like ASCII or ISO-8859-1 to properly work with surrogate escapes. Just like CP1252 Roman 8 includes Unicode characters which are encoded in multiple bytes. The final comparison in this test does not handle that. Disable it because assumptions aren't met. Patch by Michael Osipov. --- Lib/test/test_utf8_mode.py | 3 ++- .../NEWS.d/next/Tests/2018-08-28-09-29-00.bpo-34403.Eyek0k.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2018-08-28-09-29-00.bpo-34403.Eyek0k.rst diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py index 3e918fd54ce3ca8..e94324cb28b7393 100644 --- a/Lib/test/test_utf8_mode.py +++ b/Lib/test/test_utf8_mode.py @@ -12,7 +12,7 @@ MS_WINDOWS = (sys.platform == 'win32') - +HPUX = (sys.platform.startswith('hp-ux')) class UTF8ModeTests(unittest.TestCase): DEFAULT_ENV = { @@ -205,6 +205,7 @@ def test_locale_getpreferredencoding(self): self.assertEqual(out, 'UTF-8 UTF-8') @unittest.skipIf(MS_WINDOWS, 'test specific to Unix') + @unittest.skipIf(HPUX, 'test specific to Unix with single-byte default locale') def test_cmd_line(self): arg = 'h\xe9\u20ac'.encode('utf-8') arg_utf8 = arg.decode('utf-8') diff --git a/Misc/NEWS.d/next/Tests/2018-08-28-09-29-00.bpo-34403.Eyek0k.rst b/Misc/NEWS.d/next/Tests/2018-08-28-09-29-00.bpo-34403.Eyek0k.rst new file mode 100644 index 000000000000000..bc732bdea883053 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2018-08-28-09-29-00.bpo-34403.Eyek0k.rst @@ -0,0 +1 @@ +Skip test_utf8_mode.test_cmd_line() on HP-UX. Patch by Michael Osipov.