-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtasks.py
More file actions
39 lines (28 loc) · 757 Bytes
/
tasks.py
File metadata and controls
39 lines (28 loc) · 757 Bytes
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
import glob
import os
from invoke import task
SOURCE_PATH = 'django_pymodsecurity'
TESTS_PATH = 'tests'
@task
def format(ctx, noimports=False, nostyle=False):
if not noimports:
from isort import SortImports
if not nostyle:
from yapf.yapflib.yapf_api import FormatFile
for filename in glob.glob('**/*.py', recursive=True):
if not noimports:
SortImports(filename)
if not nostyle:
FormatFile(filename, in_place=True)
@task
def test(ctx, n='auto', m='1', debug=False, nocapture=False):
import pytest
args = [
'-n=%s' % n,
'-m=%s' % m,
]
if debug:
args.append('-vv')
if nocapture:
args.append('--capture=no')
pytest.main(args)