Python 3.7 test failure -- `test_CLI`

Adam Turner <[email protected]> Thu, 9 Jun 2022 10:58:49 +0000
Newsgroups gmane.text.docutils.user
Message-ID <LO3P123MB2681C798BC496AA688C2F9C6C2A79@LO3P123MB2681.GBRP123.PROD.OUTLOOK.COM>
test_CLI fails on Python 3.7 as "utf-8" is capitalised in the actual output.

Attached is a patch to fix the failure.

A
0001-Fix-test_CLI-for-Python-3.7.patch (application/octet-stream, 1019 B)
From f86317d1dee2d8f7d592cde7aea4a180b8054fd4 Mon Sep 17 00:00:00 2001
From: Adam Turner <[email protected]>
Date: Thu, 9 Jun 2022 11:53:52 +0100
Subject: [PATCH] Fix test_CLI for Python 3.7

---
 docutils/test/test_CLI.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docutils/test/test_CLI.py b/docutils/test/test_CLI.py
index 2dd6a8370..f99aa7847 100644
--- a/docutils/test/test_CLI.py
+++ b/docutils/test/test_CLI.py
@@ -62,6 +62,9 @@ class CliTests(unittest.TestCase):
         # replace unpredictable paths (eventually wrapped)
         output = re.sub(r'default:[^)]*/[^)]*\)', 'default: [...])',
                         output, flags=re.DOTALL)
+        if sys.version_info[:2] == (3, 7):
+            output = output.replace('UTF-8:backslashreplace',
+                                    'utf-8:backslashreplace')
         # compare to stored version
         with open('data/help/docutils.txt') as samplefile:
             expected = samplefile.read()
-- 
2.34.1.windows.1