2014-01-28 15:25:40 +01:00
|
|
|
import sys
|
2014-01-28 15:49:52 +01:00
|
|
|
import subprocess
|
|
|
|
from pkg_resources import load_entry_point, DistributionNotFound
|
2014-01-28 16:13:23 +01:00
|
|
|
from collections import OrderedDict
|
2014-01-28 15:25:40 +01:00
|
|
|
|
2014-01-28 16:13:23 +01:00
|
|
|
status = OrderedDict()
|
2014-01-28 16:14:10 +01:00
|
|
|
testmodule = 'qutebrowser'
|
2014-01-28 15:25:40 +01:00
|
|
|
|
|
|
|
def run(name, args=None):
|
2014-01-28 16:14:10 +01:00
|
|
|
sys.argv = [name, testmodule]
|
2014-01-28 15:25:40 +01:00
|
|
|
if args is not None:
|
|
|
|
sys.argv += args
|
|
|
|
print("====== {} ======".format(name))
|
|
|
|
try:
|
|
|
|
load_entry_point(name, 'console_scripts', name)()
|
|
|
|
except SystemExit as e:
|
|
|
|
status[name] = e
|
2014-01-28 15:49:52 +01:00
|
|
|
except DistributionNotFound:
|
|
|
|
if args is None:
|
|
|
|
args = []
|
|
|
|
try:
|
|
|
|
status[name] = subprocess.call([name] + args)
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
print('{}: {}'.format(e.__class__.__name__, e))
|
|
|
|
status[name] = None
|
2014-01-28 15:25:40 +01:00
|
|
|
except Exception as e:
|
2014-01-28 15:50:11 +01:00
|
|
|
print('{}: {}'.format(e.__class__.__name__, e))
|
2014-01-28 15:25:40 +01:00
|
|
|
status[name] = None
|
|
|
|
print()
|
|
|
|
|
2014-01-28 16:13:11 +01:00
|
|
|
pylint_disable = [
|
2014-01-28 19:51:49 +01:00
|
|
|
'import-error', # import seems unreliable
|
|
|
|
'no-name-in-module',
|
|
|
|
'invalid-name', # short variable names can be nice
|
|
|
|
'star-args', # we want to use this
|
|
|
|
'fixme', # I'll decide myself when to fix them
|
|
|
|
'too-many-public-methods', # Basically unavoidable with Qt
|
|
|
|
'no-self-use', # I'll decide that myself, thanks
|
|
|
|
'super-on-old-class', # These don't even exist in python3
|
|
|
|
'old-style-class',
|
|
|
|
'global-statement', # Sometimes necessary
|
2014-01-28 16:13:11 +01:00
|
|
|
]
|
|
|
|
|
2014-01-28 15:56:50 +01:00
|
|
|
run('pylint', ['--ignore=appdirs.py', '--output-format=colorized',
|
2014-01-28 16:13:11 +01:00
|
|
|
'--reports=no', '--disable=' + ','.join(pylint_disable)])
|
2014-01-28 15:56:50 +01:00
|
|
|
run('flake8', ['--max-complexity=10', '--exclude=appdirs.py'])
|
2014-01-28 15:25:40 +01:00
|
|
|
|
|
|
|
print('Exit status values:')
|
|
|
|
for (k, v) in status.items():
|
|
|
|
print(' {} - {}'.format(k, v))
|