From 6dc655898df34ad424dfc467a8b276fdf31bd791 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Jun 2024 06:45:15 +0200 Subject: Merging upstream version 3.0.46. Signed-off-by: Daniel Baumann --- docs/conf.py | 6 +++--- docs/pages/advanced_topics/unit_testing.rst | 15 +++++++++++++++ docs/pages/full_screen_apps.rst | 4 ++-- docs/pages/progress_bars.rst | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index abf6db3..dbbcecc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,16 +41,16 @@ master_doc = "index" # General information about the project. project = "prompt_toolkit" -copyright = "2014-2023, Jonathan Slenders" +copyright = "2014-2024, Jonathan Slenders" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = "3.0.43" +version = "3.0.46" # The full version, including alpha/beta/rc tags. -release = "3.0.43" +release = "3.0.46" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/pages/advanced_topics/unit_testing.rst b/docs/pages/advanced_topics/unit_testing.rst index 2224bfc..02ca82d 100644 --- a/docs/pages/advanced_topics/unit_testing.rst +++ b/docs/pages/advanced_topics/unit_testing.rst @@ -116,6 +116,21 @@ single fixture that does it for every test. Something like this: with create_app_session(input=pipe_input, output=DummyOutput()): yield pipe_input +For compatibility with pytest's ``capsys`` fixture, we have to create a new +:class:`~prompt_toolkit.application.current.AppSession` for every test. This +can be done in an autouse fixture. Pytest replaces ``sys.stdout`` with a new +object in every test that uses ``capsys`` and the following will ensure that +the new :class:`~prompt_toolkit.application.current.AppSession` will each time +refer to the latest output. + +.. code:: python + + from prompt_toolkit.application import create_app_session + + @fixture(autouse=True, scope="function") + def _pt_app_session() + with create_app_session(): + yield Type checking ------------- diff --git a/docs/pages/full_screen_apps.rst b/docs/pages/full_screen_apps.rst index 805c8c7..9123c20 100644 --- a/docs/pages/full_screen_apps.rst +++ b/docs/pages/full_screen_apps.rst @@ -358,7 +358,7 @@ As said earlier, a :class:`~prompt_toolkit.layout.Window` is a .. note:: - Basically, windows are the leafs in the tree structure that represent the UI. + Basically, windows are the leaves in the tree structure that represent the UI. A :class:`~prompt_toolkit.layout.Window` provides a "view" on the :class:`~prompt_toolkit.layout.UIControl`, which provides lines of content. The @@ -391,7 +391,7 @@ A :class:`~prompt_toolkit.layout.processors.Processor` operates on individual lines. Basically, it takes a (formatted) line and produces a new (formatted) line. -Some build-in processors: +Some built-in processors: +----------------------------------------------------------------------------+-----------------------------------------------------------+ | Processor | Usage: | diff --git a/docs/pages/progress_bars.rst b/docs/pages/progress_bars.rst index 54a8ee1..5248f98 100644 --- a/docs/pages/progress_bars.rst +++ b/docs/pages/progress_bars.rst @@ -237,7 +237,7 @@ printing text possible while the progress bar is displayed. This ensures that printing happens above the progress bar. Further, when "x" is pressed, we set a cancel flag, which stops the progress. -It would also be possible to send `SIGINT` to the mean thread, but that's not +It would also be possible to send `SIGINT` to the main thread, but that's not always considered a clean way of cancelling something. In the example above, we also display a toolbar at the bottom which shows the -- cgit v1.2.3