Test Failed
Push — main ( b75c67...4e8f49 )
by John Patrick
01:44
created

tests.test_main   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_main_succeeds() 0 4 1
A runner() 0 4 1
1
"""Test cases for the __main__ module."""
2
import pytest
0 ignored issues
show
introduced by
Unable to import 'pytest'
Loading history...
3
from click.testing import CliRunner
0 ignored issues
show
introduced by
Unable to import 'click.testing'
Loading history...
4
5
from trending_homebrew import __main__
0 ignored issues
show
introduced by
Unable to import 'trending_homebrew'
Loading history...
6
7
8
@pytest.fixture
9
def runner() -> CliRunner:
10
    """Fixture for invoking command-line interfaces."""
11
    return CliRunner()
12
13
14
def test_main_succeeds(runner: CliRunner) -> None:
0 ignored issues
show
Comprehensibility Bug introduced by
runner is re-defining a name which is already available in the outer-scope (previously defined on line 9).

It is generally a bad practice to shadow variables from the outer-scope. In most cases, this is done unintentionally and might lead to unexpected behavior:

param = 5

class Foo:
    def __init__(self, param):   # "param" would be flagged here
        self.param = param
Loading history...
15
    """It exits with a status code of zero."""
16
    result = runner.invoke(__main__.main)
17
    assert result.exit_code == 0
18