-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtube.py
41 lines (29 loc) · 918 Bytes
/
tube.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
"""Configuration for testtube.
Automatically run tests when files change by running: stir
See: https://github.com/thomasw/testtube
For flake8, don't forget to install:
* flake8-quotes
"""
import doctest
from testtube.helpers import Flake8, Helper, Nosetests
class ScreenClearer(Helper):
command = 'clear'
def success(self, *args):
pass
class Isort(Helper):
command = 'isort'
def get_args(self):
return ['--check']
class UnitTests(Nosetests):
def get_args(self, *args, **kwargs):
args = ['-x']
if hasattr(doctest, 'FAIL_FAST'):
args.append('--doctest-options=+FAIL_FAST')
return args
clear = ScreenClearer(all_files=True)
lint_style = Flake8(all_files=True)
unit_tests = UnitTests(all_files=True)
PATTERNS = (
(r'.*\.(py|rst|cfg)$', [clear, unit_tests], {'fail_fast': True}),
(r'.*\.py$', [lint_style], {'fail_fast': True}),
)