Skip to content

Instantly share code, notes, and snippets.

@nacht
Created May 23, 2015 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nacht/79493dc07508675e6348 to your computer and use it in GitHub Desktop.
Save nacht/79493dc07508675e6348 to your computer and use it in GitHub Desktop.
Running Python Behave with Sniffer Autotest
"""
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