Created
May 23, 2015 12:13
-
-
Save nacht/79493dc07508675e6348 to your computer and use it in GitHub Desktop.
Running Python Behave with Sniffer Autotest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Behave http://pythonhosted.org/behave/ | |
Sniffer https://pypi.python.org/pypi/sniffer | |
pip list output | |
behave (1.2.5) | |
sniffer (0.3.5) | |
""" | |
from sniffer.api import * | |
import os | |
import termstyle | |
pass_fg_color = termstyle.green | |
pass_bg_color = termstyle.bg_default | |
fail_fg_color = termstyle.red | |
fail_bg_color = termstyle.bg_default | |
watch_paths = ['.', 'tests/', 'features/'] | |
@file_validator | |
def py_files(filename): | |
return filename.endswith('.py') and not os.path.basename(filename).startswith('.') | |
@runnable | |
def execute_nose(*args): | |
import nose | |
return nose.run(argv=list(args)) | |
@runnable | |
def execute_behave(*args): | |
from behave import __main__ | |
from behave import configuration | |
try: | |
return __main__.main() | |
except SystemExit as x: | |
print "found error {0}: {1}".format(x.code, x.message) | |
except: | |
print "Unexpected error:", sys.exc_info()[0] | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment