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

tests.test_main.test_main_succeeds()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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