forked from KeyWeeUsr/Bear
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.py
47 lines (40 loc) · 1.08 KB
/
check.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
47
"""
Style checker and test + coverage runner for Bear.
"""
from subprocess import Popen
from os.path import join, dirname, abspath
ROOT = dirname(abspath(__file__))
PKG = join(ROOT, 'bear')
CASES = [[
'python', '-m', 'pycodestyle',
'--ignore=none',
'--show-source',
'--count',
'--max-line-length=79',
ROOT
], [
'python', '-m', 'pylint',
'--jobs=0',
'release.py', 'check.py', 'setup.py', PKG
], [
'python', '-m', 'coverage', 'run', '--branch', '--source', PKG,
'-m', 'unittest', 'discover',
'--failfast',
'--catch',
'--start-directory', join(PKG, 'tests'),
'--top-level-directory', PKG
], [
'python', '-m', 'coverage', 'report', '--show-missing'
]]
if __name__ == '__main__':
CASES_LEN = len(CASES)
for i, test in enumerate(CASES):
proc = Popen(test)
proc.communicate()
current = str(i + 1).zfill(len(str(CASES_LEN)))
print(f'[{current}/{CASES_LEN}] ', end='')
if proc.returncode == 0:
print('Success!')
else:
print('Fail!')
exit(proc.returncode)