def tester(tests): for t in tests: try: mod, mod_name = get_test_mod(t) except TypeError: continue except Exception, e: print e continue fname = "" n = len(mod.parameter_list) for i in xrange(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t, i + 1, n) try: a = run_test(mod, mod_name, i) b = pickle.load(file(fname)) try: if compare(a, b): print "%-60s OK" % setting_str else: print "%-60s ERROR" % setting_str #import pdb #pdb.set_trace() except: import pdb pdb.set_trace() except Exception, e: print "%-60s EXCEPTION %s" % (setting_str, e) pass
def tester(tests, cmp_method, tolerance, failures, missing): for t in tests: try: mod, mod_name = get_test_mod(t) n = len(mod.parameter_list) except TypeError: continue except Exception, e: print "%-60s ERROR (%s)" % (t, e) continue fname = "" for i in xrange(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t, i + 1, n) try: a = run_test(mod, mod_name, i) b = pickle.load(file(fname)) try: if cmp_method(a, b, tolerance): if not failures and not missing: print "%-60s OK" % setting_str else: if not missing: print "%-60s ERROR" % setting_str except Exception, e: print setting_str, e except IOError, e: if not failures: print "%-60s NO TEST" % (setting_str) except Exception, e: if not missing: print "%-60s EXCEPTION %s" % (setting_str, e)
def tester(tests, cmp_method, tolerance): for t in tests: try: mod, mod_name = get_test_mod(t) except TypeError: continue except Exception, e: print e continue fname = "" n=len(mod.parameter_list) for i in xrange(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t,i+1,n) try: a = run_test(mod, mod_name, i) b = pickle.load(file(fname)) try: if cmp_method(a,b,tolerance): print "%-60s OK" % setting_str else: print "%-60s ERROR" % setting_str except: import pdb pdb.set_trace() except Exception, e: print "%-60s EXCEPTION %s" % (setting_str,e) pass
def tester(tests, cmp_method, tolerance, failures, missing): for t in tests: try: mod, mod_name = get_test_mod(t) n=len(mod.parameter_list) except TypeError: continue except Exception, e: print "%-60s ERROR (%s)" % (t,e) continue fname = "" for i in xrange(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t,i+1,n) try: a = run_test(mod, mod_name, i) b = pickle.load(file(fname)) try: if cmp_method(a,b,tolerance): if not failures and not missing: print "%-60s OK" % setting_str else: if not missing: print "%-60s ERROR" % setting_str except Exception, e: print setting_str, e except IOError, e: if not failures: print "%-60s NO TEST" % (setting_str) except Exception, e: if not missing: print "%-60s EXCEPTION %s" % (setting_str,e)
def tester(tests, cmp_method, opts): failed=[] sgtolerance = opts.sgtolerance tolerance = opts.tolerance failures = opts.failures missing = opts.missing for t in tests: try: mod, mod_name = get_test_mod(t) n=len(mod.parameter_list) except TypeError: continue except Exception as e: print("%-60s ERROR (%s)" % (t,e)) failed.append(t) continue fname = "" for i in range(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t,i+1,n) try: a = run_test(mod, mod_name, i) try: b = pickle.load(open(fname)) except: try: b = pickle.load(open(fname, 'rb')) except: with open(fname, 'rb') as f: p = pickle._Unpickler(f) p.encoding = 'latin1' b = p.load() try: if cmp_method(a,b,tolerance,sgtolerance): if not failures and not missing: print("%-60s OK" % setting_str) else: if not missing: failed.append((setting_str, get_fail_string(a), get_fail_string(b))) print("%-60s ERROR" % setting_str) except Exception as e: print(setting_str, e) except IOError as e: if not failures: print("%-60s NO TEST (%s)" % (setting_str, e)) except Exception as e: failed.append(setting_str) if not missing: print("%-60s EXCEPTION %s" % (setting_str,e)) return failed
def tester(tests, cmp_method, opts): failed = [] sgtolerance = opts.sgtolerance tolerance = opts.tolerance failures = opts.failures missing = opts.missing for t in tests: try: mod, mod_name = get_test_mod(t) n = len(mod.parameter_list) except TypeError: continue except Exception as e: print("%-60s ERROR (%s)" % (t, e)) failed.append(t) continue fname = "" for i in range(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t, i + 1, n) try: a = run_test(mod, mod_name, i) try: b = pickle.load(open(fname)) except: try: b = pickle.load(open(fname, 'rb')) except: with open(fname, 'rb') as f: p = pickle._Unpickler(f) p.encoding = 'latin1' b = p.load() try: if cmp_method(a, b, tolerance, sgtolerance): if not failures and not missing: print("%-60s OK" % setting_str) else: if not missing: failed.append((setting_str, get_fail_string(a), get_fail_string(b))) print("%-60s ERROR" % setting_str) except Exception as e: print(setting_str, e) except IOError as e: if not failures: print("%-60s NO TEST (%s)" % (setting_str, e)) except Exception as e: failed.append(setting_str) if not missing: print("%-60s EXCEPTION %s" % (setting_str, e)) return failed
def tester(tests, cmp_method, tolerance, failures, missing): failed = [] for t in tests: try: mod, mod_name = get_test_mod(t) n = len(mod.parameter_list) except TypeError: continue except Exception as e: print("%-60s ERROR (%s)" % (t, e)) failed.append(t) continue fname = "" for i in range(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t, i + 1, n) try: a = run_test(mod, mod_name, i) b = pickle.load(open(fname)) try: if cmp_method(a, b, tolerance): if not failures and not missing: print("%-60s OK" % setting_str) else: if not missing: failed.append((setting_str, get_fail_string(a), get_fail_string(b))) print("%-60s ERROR" % setting_str) except Exception as e: print(setting_str, e) except IOError as e: if not failures: print("%-60s NO TEST (%s)" % (setting_str, e)) except Exception as e: failed.append(setting_str) if not missing: print("%-60s EXCEPTION %s" % (setting_str, e)) return failed
def tester(tests, cmp_method, tolerance, failures, missing): failed=[] for t in tests: try: mod, mod_name = get_test_mod(t) n=len(mod.parameter_list) except TypeError: continue except Exception as e: print("%-60s ERROR (%s)" % (t,e)) failed.append(t) continue fname = "" for i in range(n): fname = get_fname(mod_name, i) setting_str = "%s setting %d/%d" % (t,i+1,n) try: a = run_test(mod, mod_name, i) b = pickle.load(open(fname)) try: if cmp_method(a,b,tolerance): if not failures and not missing: print("%-60s OK" % setting_str) else: if not missing: failed.append((setting_str, get_fail_string(a), get_fail_string(b))) print("%-60s ERROR" % setting_str) except Exception as e: print(setting_str, e) except IOError as e: if not failures: print("%-60s NO TEST (%s)" % (setting_str, e)) except Exception as e: failed.append(setting_str) if not missing: print("%-60s EXCEPTION %s" % (setting_str,e)) return failed