| Conditions | 6 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/env python |
||
| 29 | def test_fd_tee_output(capsys): |
||
| 30 | expected_lines = { |
||
| 31 | "captured stdout", |
||
| 32 | "captured stderr", |
||
| 33 | "and this is from echo"} |
||
| 34 | if not sys.platform.startswith('win'): |
||
| 35 | # FIXME: this line randomly doesn't show on windows (skip for now) |
||
| 36 | expected_lines.add("stdout from C") |
||
| 37 | |||
| 38 | capture_stdout = get_stdcapturer("FD") |
||
| 39 | with capsys.disabled(): |
||
| 40 | print('before (stdout)') |
||
| 41 | print('before (stderr)') |
||
| 42 | with capture_stdout() as (f, final_out): |
||
| 43 | print("captured stdout") |
||
| 44 | print("captured stderr") |
||
| 45 | if not sys.platform.startswith('win'): |
||
| 46 | libc.puts(b'stdout from C') |
||
| 47 | libc.fflush(None) |
||
| 48 | os.system('echo and this is from echo') |
||
| 49 | |||
| 50 | print('after (stdout)') |
||
| 51 | print('after (stderr)') |
||
| 52 | |||
| 53 | assert set(final_out[0].strip().split("\n")) == expected_lines |
||
| 54 |