Exemple #1
0
def runtests(type):
    import sys

    obj = type()

    failCnt = 0
    for x in dir(type):
        if not x.startswith("test_"):
            continue

        test = getattr(obj, x)
        if not callable(test):
            continue
        typename = get_class_name(type)

        print "Running", ("%s\\%s ..." % (typename, x)).ljust(50),
        log_filename = get_file_name(type, x)
        run_single_test(test, log_filename)

        if is_cli:
            cli_log = log_filename
            win_log = "win_" + log_filename[4:]
            dif_log = "dif_" + log_filename[4:]
            dif_logfile = open(fullpath(dif_log), "w+")

            print "comparing ...",
            (val, summary) = rulediff.compare(fullpath(win_log), fullpath(cli_log), dif_logfile)

            if val == 0:
                print "PASS "
            else:
                print "FAIL [%s]" % summary
                print "         windiff %s %s" % (win_log, cli_log)
                print "         notepad %s " % dif_log
                failCnt += 1
            dif_logfile.close()
        else:
            print "skip comparing"

    if failCnt:
        raise AssertionError, "Failed"
Exemple #2
0
def runtests(type):
    import sys
    obj = type()

    failCnt = 0
    for x in dir(type):
        if not x.startswith("test_"): continue

        test = getattr(obj, x)
        if not callable(test): continue
        typename = get_class_name(type)

        print 'Running', ('%s\\%s ...' % (typename, x)).ljust(50),
        log_filename = get_file_name(type, x)
        run_single_test(test, log_filename)

        if is_cli:
            cli_log = log_filename
            win_log = 'win_' + log_filename[4:]
            dif_log = 'dif_' + log_filename[4:]
            dif_logfile = open(fullpath(dif_log), "w+")

            print "comparing ...",
            (val, summary) = rulediff.compare(fullpath(win_log),
                                              fullpath(cli_log), dif_logfile)

            if val == 0:
                print "PASS "
            else:
                print "FAIL [%s]" % summary
                print "         windiff %s %s" % (win_log, cli_log)
                print "         notepad %s " % dif_log
                failCnt += 1
            dif_logfile.close()
        else:
            print "skip comparing"

    if failCnt:
        raise AssertionError, "Failed"