aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3/tests/test_key_binding.py
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-04-06 18:18:01 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-04-06 18:18:01 +0300
commit01fbacb386809436dfa331780875aed72cb76118 (patch)
tree04c911ad96ff0523bd4d3e7a45c23cf2f2d7607d /contrib/python/prompt-toolkit/py3/tests/test_key_binding.py
parent48fb997d7f820a474b9094a72d9798a95ec612b7 (diff)
downloadydb-01fbacb386809436dfa331780875aed72cb76118.tar.gz
intermediate changes
ref:b4f892f3c2b06a356c155f73c27efc5661a7fb89
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/tests/test_key_binding.py')
-rw-r--r--contrib/python/prompt-toolkit/py3/tests/test_key_binding.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/python/prompt-toolkit/py3/tests/test_key_binding.py b/contrib/python/prompt-toolkit/py3/tests/test_key_binding.py
index 617e71c1e1..6f03f2deab 100644
--- a/contrib/python/prompt-toolkit/py3/tests/test_key_binding.py
+++ b/contrib/python/prompt-toolkit/py3/tests/test_key_binding.py
@@ -1,3 +1,5 @@
+from contextlib import contextmanager
+
import pytest
from prompt_toolkit.application import Application
@@ -21,16 +23,21 @@ class Handlers:
return func
+@contextmanager
def set_dummy_app():
"""
Return a context manager that makes sure that this dummy application is
active. This is important, because we need an `Application` with
`is_done=False` flag, otherwise no keys will be processed.
"""
- app = Application(
- layout=Layout(Window()), output=DummyOutput(), input=create_pipe_input()
- )
- return set_app(app)
+ with create_pipe_input() as pipe_input:
+ app = Application(
+ layout=Layout(Window()),
+ output=DummyOutput(),
+ input=pipe_input,
+ )
+ with set_app(app):
+ yield
@pytest.fixture