Ejemplo n.º 1
0
def test_cli_parse_not_found(runner, echo, app, patch):
    """
    Ensures the parse command catches errors
    """
    patch.object(StoryError, 'message')
    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.message())
Ejemplo n.º 2
0
def test_cli_lex_not_found(patch, runner, echo, app):
    """
    Ensures the lex command catches errors
    """
    patch.object(StoryError, 'message')
    ce = CompilerError(None)
    patch.object(App, 'lex')
    App.lex.side_effect = StoryError(ce, None)
    e = runner.invoke(Cli.lex, ['/a/non/existent/file'])
    assert e.exit_code == 1
    click.echo.assert_called_with(StoryError.message())
Ejemplo n.º 3
0
def test_cli_format_not_found(patch, runner, echo, app):
    """
    Ensures the format command catches errors
    """
    patch.object(StoryError, "message")
    ce = CompilerError(None)
    patch.object(App, "format")
    App.format.side_effect = StoryError(ce, None)
    e = runner.invoke(Cli.format, ["/a/non/existent/file"])
    assert e.exit_code == 1
    click.echo.assert_called_with(StoryError.message())