Skip to content

Commit

Permalink
Skip test_readline.test_nonascii() on C locale (python#5203)
Browse files Browse the repository at this point in the history
bpo-29240: On FreeBSD, if the LC_CTYPE locale is "C" or "POSIX",
writing and reading non-ASCII bytes into/from a TTY works,
but readline or ncurses ignores non-ASCII bytes on read.
  • Loading branch information
vstinner authored Jan 16, 2018
1 parent 4d9aec0 commit c495e79
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Lib/test/test_readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from contextlib import ExitStack
from errno import EIO
import locale
import os
import selectors
import subprocess
Expand Down Expand Up @@ -153,6 +154,13 @@ def test_auto_history_disabled(self):
self.assertIn(b"History length: 0\r\n", output)

def test_nonascii(self):
loc = locale.setlocale(locale.LC_CTYPE, None)
if loc in ('C', 'POSIX'):
# bpo-29240: On FreeBSD, if the LC_CTYPE locale is C or POSIX,
# writing and reading non-ASCII bytes into/from a TTY works, but
# readline or ncurses ignores non-ASCII bytes on read.
self.skipTest(f"the LC_CTYPE locale is {loc!r}")

try:
readline.add_history("\xEB\xEF")
except UnicodeEncodeError as err:
Expand Down

0 comments on commit c495e79

Please sign in to comment.