def run_test_function(test, args=[]):
    try:
        test.starttime = datetime.now()
        test(*args)
        test.endtime = datetime.now()
        totals['pass'] += 1
        test.result = True
        reports.report_test_function(test)
        return True
    except AssertionError, inst:
        test.endtime = datetime.now()
        if pygments:
            formatter.highlight_traceback(sys.exc_info())
        else:
            tb = traceback.format_exception(*sys.exc_info())
            tb.pop(1)
            print 'Failed '+test.__name__
            print ''.join(tb)
        if global_settings.pdb:
            pdb.post_mortem(sys.exc_info()[2])
        totals['fail'] += 1
        test.result = False
        test.tb = traceback.format_exception(*sys.exc_info())
        test.e = inst
        reports.report_test_function(test)
        return False
示例#2
0
def run_test_function(test, args=[]):
    try:
        test.starttime = datetime.now()
        test(*args)
        test.endtime = datetime.now()
        totals['pass'] += 1
        test.result = True
        reports.report_test_function(test)
        return True
    except AssertionError, inst:
        test.endtime = datetime.now()
        if pygments:
            formatter.highlight_traceback(sys.exc_info())
        else:
            tb = traceback.format_exception(*sys.exc_info())
            tb.pop(1)
            print 'Failed ' + test.__name__
            print ''.join(tb)
        if global_settings.pdb:
            pdb.post_mortem(sys.exc_info()[2])
        totals['fail'] += 1
        test.result = False
        test.tb = traceback.format_exception(*sys.exc_info())
        test.e = inst
        reports.report_test_function(test)
        return False
            tb.pop(1)
            print 'Failed '+test.__name__
            print ''.join(tb)
        if global_settings.pdb:
            pdb.post_mortem(sys.exc_info()[2])
        totals['fail'] += 1
        test.result = False
        test.tb = traceback.format_exception(*sys.exc_info())
        test.e = inst
        reports.report_test_function(test)
        return False
    except Exception, inst:
        test.endtime = datetime.now()
        if pygments:
            formatter.highlight_traceback(sys.exc_info())
        else:
            tb = traceback.format_exception(*sys.exc_info())
            tb.pop(1)
            print 'Failed '+test.__name__
            print ''.join(tb)
        if global_settings.pdb:
            pdb.post_mortem(sys.exc_info()[2])
        else:
            pass
        totals['fail'] += 1
        test.result = False
        test.tb = traceback.format_exception(*sys.exc_info())
        test.e = inst
        reports.report_test_function(test)
        return False
示例#4
0
            tb.pop(1)
            print 'Failed ' + test.__name__
            print ''.join(tb)
        if global_settings.pdb:
            pdb.post_mortem(sys.exc_info()[2])
        totals['fail'] += 1
        test.result = False
        test.tb = traceback.format_exception(*sys.exc_info())
        test.e = inst
        reports.report_test_function(test)
        return False
    except Exception, inst:
        test.endtime = datetime.now()
        if pygments:
            formatter.highlight_traceback(sys.exc_info())
        else:
            tb = traceback.format_exception(*sys.exc_info())
            tb.pop(1)
            print 'Failed ' + test.__name__
            print ''.join(tb)
        if global_settings.pdb:
            pdb.post_mortem(sys.exc_info()[2])
        else:
            pass
        totals['fail'] += 1
        test.result = False
        test.tb = traceback.format_exception(*sys.exc_info())
        test.e = inst
        reports.report_test_function(test)
        return False