Example #1
0
def test_set_catch_exceptions(app: Application, environ: Dict[str, str]):
    app.auto_exits(False)
    os.environ["COLUMNS"] = "120"

    tester = ApplicationTester(app)
    app.catch_exceptions(True)

    assert app.are_exceptions_caught()

    tester.execute("foo", decorated=False)

    assert tester.io.fetch_output() == ""
    assert (
        tester.io.fetch_error()
        == FIXTURES_PATH.joinpath("application_exception1.txt").read_text()
    )

    app.catch_exceptions(False)

    with pytest.raises(CommandNotFoundException):
        tester.execute("foo", decorated=False)