diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 04:45:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 04:45:14 +0000 |
commit | 5b43aaac61ac94abe722bc98ae58468618f2f512 (patch) | |
tree | 3d58c89faa23d194f83abb24ae1fd05067538fff /docs/pages | |
parent | Adding upstream version 3.0.43. (diff) | |
download | prompt-toolkit-5b43aaac61ac94abe722bc98ae58468618f2f512.tar.xz prompt-toolkit-5b43aaac61ac94abe722bc98ae58468618f2f512.zip |
Adding upstream version 3.0.46.upstream/3.0.46
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/pages')
-rw-r--r-- | docs/pages/advanced_topics/unit_testing.rst | 15 | ||||
-rw-r--r-- | docs/pages/full_screen_apps.rst | 4 | ||||
-rw-r--r-- | docs/pages/progress_bars.rst | 2 |
3 files changed, 18 insertions, 3 deletions
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 |