(base_app)
| 4448 | reason="Don't have a real Windows console with how we are currently running tests in GitHub Actions", |
| 4449 | ) |
| 4450 | def test_pre_prompt_running_loop(base_app): |
| 4451 | # Test that pre_prompt runs with a running event loop. |
| 4452 | import asyncio |
| 4453 | |
| 4454 | # Set up pipe input to feed data to prompt_toolkit |
| 4455 | with create_pipe_input() as pipe_input: |
| 4456 | # Create a new session with our pipe input because the input property is read-only |
| 4457 | base_app.main_session = PromptSession( |
| 4458 | input=pipe_input, |
| 4459 | output=DummyOutput(), |
| 4460 | history=base_app.main_session.history, |
| 4461 | completer=base_app.main_session.completer, |
| 4462 | ) |
| 4463 | |
| 4464 | loop_check = {"running": False} |
| 4465 | |
| 4466 | def my_pre_prompt(): |
| 4467 | try: |
| 4468 | asyncio.get_running_loop() |
| 4469 | loop_check["running"] = True |
| 4470 | except RuntimeError: |
| 4471 | loop_check["running"] = False |
| 4472 | |
| 4473 | base_app.pre_prompt = my_pre_prompt |
| 4474 | |
| 4475 | # Feed input to exit prompt immediately |
| 4476 | pipe_input.send_text("foo\n") |
| 4477 | |
| 4478 | # Ensure self.session.prompt is used |
| 4479 | base_app._read_command_line("prompt> ") |
| 4480 | |
| 4481 | assert loop_check["running"] |
| 4482 | |
| 4483 | |
| 4484 | def test_get_bottom_toolbar_narrow_terminal(base_app, monkeypatch): |
nothing calls this directly
no test coverage detected
searching dependent graphs…