def test_trace_errors_ValueError(debug_mode, string_io): with pytest.raises(KeyError): with trace_errors(debug_mode=debug_mode, exceptions=(ValueError,), stream=string_io): raise KeyError("alpha") assert string_io.getvalue() == ""
def test_trace_errors_all_exceptions(debug_mode, string_io): with pytest.raises(SystemExit): with trace_errors(debug_mode=debug_mode, stream=string_io): raise KeyError("alpha") assert string_io.getvalue() == "ERR: KeyError: 'alpha'\n"