def test_cli_parse_not_found(runner, echo, app): """ Ensures the parse command catches errors """ ce = CompilerError(None) app.parse.side_effect = StoryError(ce, None) e = runner.invoke(Cli.parse, ['/a/non/existent/file']) assert e.exit_code == 1 click.echo.assert_called_with(StoryError._internal_error(ce))
def test_cli_compile_not_found(patch, runner, echo, app): """ Ensures the compile command catches errors """ patch.object(StoryError, '_internal_error') ce = CompilerError(None) app.compile.side_effect = StoryError(ce, None) e = runner.invoke(Cli.compile, ['/a/non/existent/file']) assert e.exit_code == 1 click.echo.assert_called_with(StoryError._internal_error())