test_iostream.py (12391:ceeca8b41e4b) | test_iostream.py (14299:2fbea9df56d2) |
---|---|
1from pybind11_tests import iostream as m 2import sys 3 4from contextlib import contextmanager 5 6try: 7 # Python 3 8 from io import StringIO --- 40 unchanged lines hidden (view full) --- 49 assert stderr == '' 50 51 m.captured_err(msg) 52 stdout, stderr = capsys.readouterr() 53 assert stdout == '' 54 assert stderr == msg 55 56 | 1from pybind11_tests import iostream as m 2import sys 3 4from contextlib import contextmanager 5 6try: 7 # Python 3 8 from io import StringIO --- 40 unchanged lines hidden (view full) --- 49 assert stderr == '' 50 51 m.captured_err(msg) 52 stdout, stderr = capsys.readouterr() 53 assert stdout == '' 54 assert stderr == msg 55 56 |
57def test_captured_large_string(capsys): 58 # Make this bigger than the buffer used on the C++ side: 1024 chars 59 msg = "I've been redirected to Python, I hope!" 60 msg = msg * (1024 // len(msg) + 1) 61 62 m.captured_output_default(msg) 63 stdout, stderr = capsys.readouterr() 64 assert stdout == msg 65 assert stderr == '' 66 67 |
|
57def test_guard_capture(capsys): 58 msg = "I've been redirected to Python, I hope!" 59 m.guard_output(msg) 60 stdout, stderr = capsys.readouterr() 61 assert stdout == msg 62 assert stderr == '' 63 64 --- 139 unchanged lines hidden --- | 68def test_guard_capture(capsys): 69 msg = "I've been redirected to Python, I hope!" 70 m.guard_output(msg) 71 stdout, stderr = capsys.readouterr() 72 assert stdout == msg 73 assert stderr == '' 74 75 --- 139 unchanged lines hidden --- |