summaryrefslogtreecommitdiffstats
path: root/tools/lint/test/test_pylint.py
blob: 6ee2217089a4881c8b3ded25ac02b18441525862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import mozunit

LINTER = "pylint"


def test_lint_single_file(lint, paths):
    results = lint(paths("bad.py"))
    assert len(results) == 3
    assert results[1].rule == "E0602"
    assert results[2].rule == "W0101"
    assert results[2].lineno == 5

    # run lint again to make sure the previous results aren't counted twice
    results = lint(paths("bad.py"))
    assert len(results) == 3


def test_lint_single_file_good(lint, paths):
    results = lint(paths("good.py"))
    assert len(results) == 0


if __name__ == "__main__":
    mozunit.main()