-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfabfile.py
57 lines (43 loc) · 1.25 KB
/
fabfile.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
48
49
50
51
52
53
54
55
56
57
from os.path import dirname
from fabric.context_managers import lcd
from fabric.operations import local
from fabric.state import env
ROOT_DIR = dirname(env['real_fabfile'])
SRC_DIR = '{}/chess/'.format(ROOT_DIR)
def test(*args, **kwargs):
"""
Run test suite
"""
flags = []
targets = []
if 'cov' in args:
flags.append('--cov=./chess')
if kwargs.get('cov') == 'html':
flags.append('--cov=./chess --cov-report=html')
if 'unit' in args:
targets.append('./tests/unit/')
if 'functional' in args:
targets.append('./tests/functional/')
with lcd(ROOT_DIR):
local("pytest {flags} {targets}".format(
flags=' '.join(flags),
targets=' '.join(targets) if targets else './tests/'
))
def qa():
"""
Quality assurance test
"""
with lcd(ROOT_DIR):
local('pylint ./chess --output-format=colorized')
def profile(sort=None):
flags = ''
if sort:
flags = '--sort=%s' % sort
with lcd(ROOT_DIR):
local('python -m cProfile {flags} ./example_profile.py --silent'.format(flags=flags))
def fmt():
"""
Run pep8
"""
with lcd(ROOT_DIR):
local('autopep8 --in-place --aggressive --max-line-length=120 -r ./chess')