from prompt_toolkit import print_formatted_text
from pytest import CaptureFixture
def test_1(capsys: CaptureFixture[str]) -> None:
print_formatted_text("TEST")
def test_2() -> None:
print_formatted_text("TEST")
that ends up with:
py/lib/python3.11/site-packages/prompt_toolkit/shortcuts/utils.py:164: in print_formatted_text
render()
py/lib/python3.11/site-packages/prompt_toolkit/shortcuts/utils.py:139: in render
renderer_print_formatted_text(
py/lib/python3.11/site-packages/prompt_toolkit/renderer.py:813: in print_formatted_text
output.flush()
py/lib/python3.11/site-packages/prompt_toolkit/output/plain_text.py:59: in flush
flush_stdout(self.stdout, data)
py/lib/python3.11/site-packages/prompt_toolkit/output/flush_stdout.py:33: ValueError
ValueError: I/O operation on closed file.
CaptureFixture closes the output stdout so I added checks they prevent such a case
Hello Jonathan!
I found such a problem:
that ends up with:
CaptureFixture closes the output stdout so I added checks they prevent such a case