[Python-checkins] bpo-45195: Fix test_readline.test_nonascii() (GH-28329) (GH-28333)

vstinner webhook-mailer at python.org
Wed Sep 15 08:38:53 EDT 2021


https://github.com/python/cpython/commit/ececa53b7fc9c21d0c8153153e3c19da1d0a1e80
commit: ececa53b7fc9c21d0c8153153e3c19da1d0a1e80
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: vstinner <vstinner at python.org>
date: 2021-09-15T14:38:49+02:00
summary:

bpo-45195: Fix test_readline.test_nonascii() (GH-28329) (GH-28333)

Fix test_readline.test_nonascii(): sometimes, the newline character
is not written at the end, so don't expect it in the output.
(cherry picked from commit 797c8eb9ef511f0c25f10a453b35c4d2fe383c30)

Co-authored-by: Victor Stinner <vstinner at python.org>

files:
A Misc/NEWS.d/next/Tests/2021-09-14-13-16-18.bpo-45195.EyQR1G.rst
M Lib/test/test_readline.py

diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
index e8fb8d2f9cc60..59dbef9038005 100644
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -255,7 +255,9 @@ def display(substitution, matches, longest_match_length):
             self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output)
         expected = br"'[\xefnserted]|t\xebxt[after]'"
         self.assertIn(b"result " + expected + b"\r\n", output)
-        self.assertIn(b"history " + expected + b"\r\n", output)
+        # bpo-45195: Sometimes, the newline character is not written at the
+        # end, so don't expect it in the output.
+        self.assertIn(b"history " + expected, output)
 
     # We have 2 reasons to skip this test:
     # - readline: history size was added in 6.0
diff --git a/Misc/NEWS.d/next/Tests/2021-09-14-13-16-18.bpo-45195.EyQR1G.rst b/Misc/NEWS.d/next/Tests/2021-09-14-13-16-18.bpo-45195.EyQR1G.rst
new file mode 100644
index 0000000000000..16a1f4440483c
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-09-14-13-16-18.bpo-45195.EyQR1G.rst
@@ -0,0 +1,3 @@
+Fix test_readline.test_nonascii(): sometimes, the newline character is not
+written at the end, so don't expect it in the output. Patch by Victor
+Stinner.



More information about the Python-checkins mailing list