(monkeypatch)
| 47 | |
| 48 | |
| 49 | async def test_cannot_print(monkeypatch) -> None: |
| 50 | def _raise(*args, **kwargs): |
| 51 | raise OSError |
| 52 | |
| 53 | monkeypatch.setattr(builtins, "print", _raise) |
| 54 | |
| 55 | t = termlog.TermLog() |
| 56 | with taddons.context(t) as tctx: |
| 57 | tctx.configure(t) |
| 58 | with pytest.raises(SystemExit) as exc_info: |
| 59 | logging.info("Should not log this, but raise instead") |
| 60 | |
| 61 | assert exc_info.value.args[0] == 1 |
| 62 | |
| 63 | t.uninstall() |