summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-08-18 17:38:54 (GMT)
committerGitHub <noreply@github.com>2021-08-18 17:38:54 (GMT)
commit6fb62b42f4db56ed5efe0ca4c1059049276c1083 (patch)
tree6ad61a1db4f132aee2fd90893b97b3bd0bbdc383
parent8cf07d3db3eed02b43350a5f9dbf68f1c839ea82 (diff)
downloadcpython-6fb62b42f4db56ed5efe0ca4c1059049276c1083.zip
cpython-6fb62b42f4db56ed5efe0ca4c1059049276c1083.tar.gz
cpython-6fb62b42f4db56ed5efe0ca4c1059049276c1083.tar.bz2
bpo-44949: Fix test_readline auto history tests (#27813)
-rw-r--r--Lib/test/test_readline.py8
-rw-r--r--Misc/NEWS.d/next/Tests/2021-08-18-18-30-12.bpo-44949.VE5ENv.rst2
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
index f3e404d..e8fb8d2 100644
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -156,11 +156,15 @@ print("History length:", readline.get_current_history_length())
def test_auto_history_enabled(self):
output = run_pty(self.auto_history_script.format(True))
- self.assertIn(b"History length: 1\r\n", output)
+ # bpo-44949: Sometimes, the newline character is not written at the
+ # end, so don't expect it in the output.
+ self.assertIn(b"History length: 1", output)
def test_auto_history_disabled(self):
output = run_pty(self.auto_history_script.format(False))
- self.assertIn(b"History length: 0\r\n", output)
+ # bpo-44949: Sometimes, the newline character is not written at the
+ # end, so don't expect it in the output.
+ self.assertIn(b"History length: 0", output)
def test_nonascii(self):
loc = locale.setlocale(locale.LC_CTYPE, None)
diff --git a/Misc/NEWS.d/next/Tests/2021-08-18-18-30-12.bpo-44949.VE5ENv.rst b/Misc/NEWS.d/next/Tests/2021-08-18-18-30-12.bpo-44949.VE5ENv.rst
new file mode 100644
index 0000000..7fdf181
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-08-18-18-30-12.bpo-44949.VE5ENv.rst
@@ -0,0 +1,2 @@
+Fix auto history tests of test_readline: sometimes, the newline character is
+not written at the end, so don't expect it in the output.