def test2(self, function, points, ms, typ=None, **kwds): if _Simplifys and function.__name__[8:] not in _Simplifys: return # skip this simplify function n = len(points) t = ', '.join('%s=%s' % t for t in sorted(kwds.items())) f = '%s(%s, %s)' % (function.__name__, n, t) S = s = 0 for m in reversed(sorted(ms.keys())): s = time() r = function(points, m, **kwds) n = len(r) s = time() - s t = '%s %dm (%s)' % (f, m, secs2str(s)) self.test(t, n, ms[m]) S += s if typ: self.test(str(type(r)), type(r) is typ, True) if S > s: # sub-total time self.test__('%s %s', f, secs2str(S), nt=1)
elif _failedonly: for t in r.split(NL): # print failures, KNOWN ones and totals if 'FAILED,' in t or 'passed' in t: print(t.rstrip()) print('') elif _verbose: print(r + NL) elif x: for t in r.split(NL): # print failures, without KNOWN ones if 'FAILED,' in t and 'KNOWN' not in t: print(t.rstrip()) if X: x = '%d FAILED' % (X, ) elif T > 0: x = 'all %s tests OK' % (T, ) else: x = 'all OK' s = secs2str(time() - s) t = '%s %s %s (%s) %s' % (argv0, Python_O, x, v, s) print(t) if _results: _write(NL + t + NL) _results.close()
if _results: # save all test results t = '-'.join(['testresults'] + v.split()) + '.txt' t = join(PyGeodesy_dir, 'testresults', t) _results = open(t, 'wb') # note, 'b' not 't'! _write('%s typical test results (%s)%s' % (argv0, v, NL)) s = time() try: for arg in args: _run(*arg.split()) except KeyboardInterrupt: _exit('', '^C', 9) except SystemExit: pass s = time() - s t = secs2str(s) if _Total > s > 1: t = '%s (%.3f tps)' % (t, _Total / s) if _FailX: s = '' if _FailX == 1 else 's' x = '%d (of %d) test%s FAILED' % (_FailX, _Total, s) elif _Total > 0: x = 'all %d tests OK' % (_Total, ) else: x = 'all OK' t = '%s %s %s (%s) %s' % (argv0, PythonX_O, x, v, t) _exit(t, t, 2 if _FailX else 0) # **) MIT License