vdirsyncer/tests/test_doubleclick.py
Markus Unterwaditzer 0bc03666ba Fix dead doubleclick testcase
click.CliRunner swallowed all exceptions, also AssertionError
2014-08-30 17:06:01 +02:00

28 lines
726 B
Python

# -*- coding: utf-8 -*-
'''
tests.test_doubleclick
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer & contributors
:license: MIT, see LICENSE for more details.
'''
from click.testing import CliRunner
from vdirsyncer.doubleclick import _ctx_stack, click, ctx as global_ctx
def test_simple():
@click.command()
@click.pass_context
def cli(ctx):
assert global_ctx
assert ctx.obj is global_ctx.obj
assert _ctx_stack.top is ctx
click.echo('hello')
assert not global_ctx
runner = CliRunner()
result = runner.invoke(cli, catch_exceptions=False)
assert not global_ctx
assert not result.exception
assert result.output == 'hello\n'