sniffer
sniffer copied to clipboard
on second run, output is not printed on stdout
first run is ok, but after something is modified, the runner works but nothing is displayed on the terminal
sometimes I get "Unhandled exception in thread started by "
Hey @idoroseman, I can't reproduce this locally on my machine. Could you give me more information about your problem?
- What version of sniffer?
- Did you install pyinotify, pywin32, MacFSEvents?
- Are you running nose tests, pietists, etc.?
Steps to reproduce would be great!
Thanks, Jeff
Hi Jeff I'm using sniffer 0.3.3 running on mac, so MacFSEvents redericting stdout to a file, I can confirm the script is running I'm running "behave" using the following scent.py
from sniffer.api import * # import the really small API
import os, termstyle, sys
# you can customize the pass/fail colors like this
pass_fg_color = termstyle.green
pass_bg_color = termstyle.bg_default
fail_fg_color = termstyle.red
fail_bg_color = termstyle.bg_default
# All lists in this variable will be under surveillance for changes.
watch_paths = ['.', 'features/']
# this gets invoked on every file that gets changed in the directory. Return
# True to invoke any runnable functions, False otherwise.
#
# This fires runnables only if files ending with .py extension and not prefixed
# with a period.
@file_validator
def not_pyc_files(filename):
## should change to check .hgignore
return not filename.endswith('.pyc') and not os.path.basename(filename).startswith('.')
# This gets invoked for verification. This is ideal for running tests of some sort.
# For anything you want to get constantly reloaded, do an import in the function.
#
# sys.argv[0] and any arguments passed via -x prefix will be sent to this function as
# it's arguments. The function should return logically True if the validation passed
# and logicially False if it fails.
#
# This example simply runs nose.
@runnable
def execute_behave(*args):
from behave import configuration
from behave import __main__
# Adding my wanted option to parser.
#configuration.parser.add_argument('-u', '--url', help="Address of your url")
# command that run behave.
try:
return __main__.main()
except SystemExit as x:
print "found error {0}: {1}".format(x.code, x.message)
return not x.code
except:
print "Unexpected error:", sys.exc_info()[0]
return 0
Hey @idoroseman,
execute_behave
needs to make sure it returns True if the tests pass.
__main__.main()
returns 0 if it succeeds, which is false.
Also, an alternative is to use subprocess to just call behave
instead (don't forget to check the exit code).