Skip to content

test.test_pyrepl.test_pyrepl.TestMain.test_readline_history_file fails on MacOS with TERM=dumb #123870

@diegorusso

Description

@diegorusso

Bug report

Bug description:

Hello,

I've seen already issues with TERM=dumb and pyrepl but I haven't seen any specific to MacOS. We discovered this on our CI based on Jenkins but I was able to replicate it on my Mac as well hence reporting the issue.
readline is installed via brew

Note: the same steps work on Linux.

$ export TERM=dumb
$ export EXTRATESTOPTS="test_pyrepl"
$ make test
Checked 112 modules (34 built-in, 78 shared, 0 n/a on macosx-14.6-arm64, 0 disabled, 0 missing, 0 failed on import)
./python.exe -E  -m test --fast-ci --timeout= test_pyrepl
+ ./python.exe -u -W default -bb -E -m test --fast-ci --timeout= test_pyrepl --dont-add-python-opts
...
...
======================================================================
FAIL: test_readline_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_readline_history_file)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dierus01/Work/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 1305, in test_readline_history_file
    output, exit_code = self.run_repl("exit\n", env=env)
                        ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Users/dierus01/Work/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 1225, in run_repl
    return self._run_repl(
           ~~~~~~~~~~~~~~^
        repl_input, env=env, cmdline_args=cmdline_args, cwd=cwd
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/dierus01/Work/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 1276, in _run_repl
    self.fail(f"Timeout while waiting for output, got: {''.join(output)}")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Timeout while waiting for output, got: exit
Python 3.14.0a0 (heads/main-dirty:7e12f70965, Sep  9 2024, 11:46:26) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: terminal doesn't have the required clear capability
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>

----------------------------------------------------------------------
Ran 145 tests in 31.105s

FAILED (failures=1, skipped=10)
test test_pyrepl failed

== Tests result: FAILURE ==

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-mactestsTests in the Lib/test dirtopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions