-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtube.py.sample
50 lines (33 loc) · 1.27 KB
/
tube.py.sample
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
"""Configuration for testtube.
Automatically run tests when files change by running: stir
See: https://github.com/thomasw/testtube
"""
from testtube.helpers import Flake8, Helper, Nosetests, Pep257
class ScreenClearer(Helper):
command = 'clear'
def success(self, *args):
pass
class FocusedTests(Helper):
"""Run tests for changed files only (using nose-knows)."""
command = 'nosetests'
def get_args(self, *args, **kwargs):
"""Return args to run nose-knows in output mode."""
return ['--with-knows', self.changed]
class FullTests(Nosetests):
"""Run all tests (includes integration tests)."""
def get_args(self, *args, **kwargs):
"""Run all integration tests and generate a knows-nose mapping file."""
return ['--with-knows', '--knows-out',
'tests', 'tests/test_integration']
clear = ScreenClearer(all_files=True)
lint = Flake8(all_files=True)
docstrings = Pep257(all_files=True)
focused_tests = FocusedTests()
full_tests = FullTests()
PATTERNS = (
(r'.*\.py$', [clear, lint, docstrings], {'fail_fast': True}),
(r'.*\.py$', [focused_tests], {'fail_fast': True}),
(r'.*\.py$', [full_tests], {'fail_fast': True}),
)
# run full tests on load to ensure a .knows file exists:
full_tests(None, None)