Skip to content

Instantly share code, notes, and snippets.

@beck
Last active October 8, 2015 20:13
Show Gist options
  • Save beck/df6d6dcc7565b2d2c8ad to your computer and use it in GitHub Desktop.
Save beck/df6d6dcc7565b2d2c8ad to your computer and use it in GitHub Desktop.
A generic testube config file
"""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
"""
from testtube.helpers import Flake8, Helper, Pep257
class DjangoTest(Helper):
command = 'python'
def get_args(self):
return ['bottomline/manage.py', 'test', '--failfast']
class ScreenClearer(Helper):
command = 'clear'
def success(self, *args):
pass
class SyntaxChecker(Flake8):
def get_args(self):
runtime_errors = 'E9'
return ['--select', runtime_errors]
class Isort(Helper):
command = 'isort'
def get_args(self):
return ['--check']
clear = ScreenClearer(all_files=True)
check_syntax = SyntaxChecker(all_files=True)
lint_style = Flake8(all_files=True)
lint_docs = Pep257(all_files=True)
lint_imports = Isort(all_files=True)
test = DjangoTest()
PATTERNS = (
(r'.*\.py$', [clear, check_syntax], {'fail_fast': True}),
(r'.*\.py$', [test], {'fail_fast': True}),
(r'.*\.py$', [lint_style, lint_docs, lint_imports]),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment