Skip to content

Commit

Permalink
add -f option to tester to only show failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Mar 28, 2012
1 parent 6fea6c9 commit cfb5860
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions testsuite/python_modular/tester.py
Expand Up @@ -68,7 +68,7 @@ def compare_dbg(a, b):
print "b", b
return False

def tester(tests, cmp_method, tolerance):
def tester(tests, cmp_method, tolerance, failures):
for t in tests:
try:
mod, mod_name = get_test_mod(t)
Expand All @@ -89,7 +89,8 @@ def tester(tests, cmp_method, tolerance):

try:
if cmp_method(a,b,tolerance):
print "%-60s OK" % setting_str
if not failures:
print "%-60s OK" % setting_str
else:
print "%-60s ERROR" % setting_str
except Exception, e:
Expand All @@ -98,7 +99,8 @@ def tester(tests, cmp_method, tolerance):
import pdb
pdb.set_trace()
except IOError, e:
print "%-60s NO TEST" % (setting_str)
if not failures:
print "%-60s NO TEST" % (setting_str)
except Exception, e:
print "%-60s EXCEPTION %s" % (setting_str,e)
pass
Expand All @@ -109,6 +111,8 @@ def tester(tests, cmp_method, tolerance):
op=OptionParser()
op.add_option("-d", "--debug", action="store_true", default=False,
help="detailed debug output of objects that don't match")
op.add_option("-f", "--failures", action="store_true", default=False,
help="show only failures")
op.add_option("-t", "--tolerance", action="store", default=None,
help="tolerance used to estimate accuracy")

Expand All @@ -119,4 +123,4 @@ def tester(tests, cmp_method, tolerance):
else:
cmp_method=compare
tests = setup_tests(args)
tester(tests, cmp_method, opts.tolerance)
tester(tests, cmp_method, opts.tolerance, opts.failures)

0 comments on commit cfb5860

Please sign in to comment.