prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.28k stars 715 forks source link

Python 3.12 test failures (Too many open files) #1719

Open carlwgeorge opened 1 year ago

carlwgeorge commented 1 year ago

Breaking this issue out from https://github.com/prompt-toolkit/python-prompt-toolkit/pull/1714#issuecomment-1411115166.

The follow tests fail when run on Python 3.12.0a4.

FAILED tests/test_cli.py::test_emacs_arguments_for_all_commands - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_emacs_kill_ring - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_emacs_selection - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_emacs_insert_comment - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_emacs_record_macro - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_emacs_nested_macro - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_prefix_meta - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_bracketed_paste - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_cursor_movements - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_operators - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_text_objects - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_digraphs - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_block_editing - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_block_editing_empty_lines - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_visual_line_copy - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_visual_empty_line - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_character_delete_after_cursor - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_character_delete_before_cursor - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_character_paste - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_temp_navigation_mode - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_vi_macros - OSError: [Errno 24] Too many open files
FAILED tests/test_cli.py::test_accept_default - OSError: [Errno 24] Too many open files
FAILED tests/test_completion.py::test_pathcompleter_completes_directories_with_only_directories - OSError: [Errno 24] Too many open files: '/tmp/tmpweazk1ay/subdir'
FAILED tests/test_completion.py::test_pathcompleter_get_paths_constrains_path - OSError: [Errno 24] Too many open files: '/tmp/tmphxggdzn6/subdir'
FAILED tests/test_history.py::test_in_memory_history - OSError: [Errno 24] Too many open files
FAILED tests/test_history.py::test_file_history - OSError: [Errno 24] Too many open files
FAILED tests/test_history.py::test_threaded_in_memory_history - OSError: [Errno 24] Too many open files
FAILED tests/test_key_binding.py::test_feed_simple - OSError: [Errno 24] Too many open files
FAILED tests/test_key_binding.py::test_feed_several - OSError: [Errno 24] Too many open files
FAILED tests/test_key_binding.py::test_control_square_closed_any - OSError: [Errno 24] Too many open files
FAILED tests/test_key_binding.py::test_common_prefix - OSError: [Errno 24] Too many open files
FAILED tests/test_key_binding.py::test_previous_key_sequence - OSError: [Errno 24] Too many open files
FAILED tests/test_shortcuts.py::test_print_container - OSError: [Errno 24] Too many open files
ERROR tests/test_history.py::test_threaded_file_history - OSError: [Errno 24] Too many open files: '/tmp/pytest-of-carl/pytest-3'

The full output for test_emacs_arguments_for_all_commands is in that other issue. I'm happy to post the output from any of these individual tests, but I figured I wouldn't overload the issue with off of the output unless needed.

jonathanslenders commented 1 year ago

Hi @carlwgeorge, can you check whether this is still the case with the latest release (3.0.37)?

carlwgeorge commented 1 year ago

With python 3.12.0a5 and prompt-toolkit 3.0.37, all the tests now pass. There are five warnings.

====================================================== warnings summary ======================================================
tests/test_key_binding.py::test_feed_simple
tests/test_key_binding.py::test_feed_several
tests/test_key_binding.py::test_control_square_closed_any
tests/test_key_binding.py::test_common_prefix
tests/test_key_binding.py::test_previous_key_sequence
  /home/carl/development/prompt-toolkit/src/prompt_toolkit/key_binding/key_processor.py:413: RuntimeWarning: coroutine 'KeyProcessor._start_timeout.<locals>.wait' was never awaited
    self._flush_wait_task = app.create_background_task(wait())
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================== 145 passed, 1 xpassed, 5 warnings in 13.81s =========================================