Ejemplo n.º 1
0
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() == ""
Ejemplo n.º 2
0
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"