forked from devoxin/Lavalink.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.py
35 lines (28 loc) · 1.27 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
import shutil
import subprocess
executable = str(shutil.which('python3.6') or shutil.which('py')).split('/')[-1]
def test_flake8():
proc = subprocess.Popen('flake8', stdout=subprocess.PIPE)
proc.wait()
out = proc.stdout.read().decode()
msg = 'OK' if not out and proc.returncode == 0 else out
print(msg)
def test_pylint():
proc = subprocess.Popen((f'{executable} -m pylint --max-line-length=150 --score=no '
'--disable=missing-docstring,wildcard-import,'
'attribute-defined-outside-init,too-few-public-methods,'
'old-style-class,import-error,invalid-name,no-init,'
'too-many-instance-attributes,protected-access,too-many-arguments,'
'too-many-public-methods,logging-format-interpolation,too-many-branches '
'lavalink').split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
out = stdout.decode()
msg = 'OK' if not out and proc.returncode == 0 else out
print(msg)
if __name__ == '__main__':
print('-- flake8 test --')
test_flake8()
print('-- pylint test --')
test_pylint()