-
Notifications
You must be signed in to change notification settings - Fork 96
/
run_tests.py
46 lines (34 loc) · 1.34 KB
/
run_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sys
from io import StringIO
import pylint.lint as pylint
from flake8.api import legacy
from pylint.reporters import text
def test_flake8():
style_guide = legacy.get_style_guide()
report = style_guide.check_files(['lavalink'])
statistics = report.get_statistics('E')
failed = bool(statistics)
if not failed:
print('OK')
return failed
def test_pylint():
stdout = StringIO()
reporter = text.TextReporter(stdout)
opts = ['--max-line-length=150', '--score=no', '--disable=missing-docstring,wildcard-import,'
'attribute-defined-outside-init,too-few-public-methods,'
'too-many-instance-attributes,protected-access,'
'too-many-arguments,too-many-public-methods,too-many-branches,'
'consider-using-with', 'lavalink']
pylint.Run(opts, reporter=reporter, exit=False)
out = reporter.out.getvalue()
failed = bool(out)
msg = 'OK' if not failed else out
print(msg)
return failed
if __name__ == '__main__':
print('-- flake8 test --')
flake_failed = test_flake8()
print('-- pylint test --')
pylint_failed = test_pylint()
if flake_failed or pylint_failed:
sys.exit(1)