tests.test_cli   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A runner() 0 3 1
A describe_cli() 0 13 1
1
"""Sample integration test module using pytest-describe and expecter."""
2
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned
3
4
import pytest
5
from click.testing import CliRunner
6
from expecter import expect
7
8
from demo.cli import main
9
10
11
@pytest.fixture
12
def runner():
13
    return CliRunner()
14
15
16
def describe_cli():
17
    def describe_conversion():
18
        def when_integer(runner):
19
            result = runner.invoke(main, ['42'])
20
21
            expect(result.exit_code) == 0
22
            expect(result.output) == "12.80165\n"
23
24
        def when_invalid(runner):
25
            result = runner.invoke(main, ['foobar'])
26
27
            expect(result.exit_code) == 0
28
            expect(result.output) == ""
29