Пример #1
0
    def test_invoke_no_args(self):
        shell = Shell()

        ctx = shell.make_context('click-shell-test', args=[])

        with pytest.raises(IOError):
            shell.invoke(ctx)
Пример #2
0
    def test_invoke_no_args(self):
        shell = Shell()

        ctx = shell.make_context('click-shell-test', args=[])

        with pytest.raises(IOError):
            shell.invoke(ctx)
Пример #3
0
    def test_invoke_with_args(self):
        shell = Shell()

        # Create a 'foo' command
        @shell.command()
        def foo():
            click.echo('bar')
            return 0

        ctx = shell.make_context('click-shell-test', args=['foo'])

        retcode = shell.invoke(ctx)

        assert retcode == 0
Пример #4
0
    def test_invoke_with_args(self):
        shell = Shell()

        # Create a 'foo' command
        @shell.command()
        def foo():
            click.echo('bar')
            return 0

        ctx = shell.make_context('click-shell-test', args=['foo'])

        retcode = shell.invoke(ctx)

        assert retcode == 0