def get_iter(self, input_iter): oks = 0 total = 0 fails = [] skips = [] test_sum_time = 0. write = self.stream.write for test in input_iter: total += 1 if test.status == 'OK': if test.expected_fail: fails.append(test.short_name()) else: oks += 1 test_sum_time += (test.end_time-test.start_time) elif test.status == 'FAIL': if test.expected_fail: oks += 1 else: fails.append(test.short_name()) test_sum_time += (test.end_time-test.start_time) elif test.status == 'SKIP': skips.append(test.short_name()) yield test # now summarize the run if skips: write("\n\nThe following tests were skipped:\n") for s in sorted(skips): write(s) write('\n') if fails: write("\n\nThe following tests failed:\n") for f in sorted(fails): write(f) write('\n') else: write("\n\nOK") write("\n\nPassed: %d\nFailed: %d\nSkipped: %d\n" % (oks, len(fails), len(skips))) wallclock = time.time() - self._start_time s = "" if total == 1 else "s" if self.options.isolated: procstr = " in isolated processes" else: procstr = " using %d processes" % self.options.num_procs write("\n\nRan %d test%s%s\nSum of test times: %s\n" "Wall clock time: %s\nSpeedup: %f\n\n" % (total, s, procstr, elapsed_str(test_sum_time), elapsed_str(wallclock), test_sum_time/wallclock))
def _print_result(self, result): stream = self.stream stats = elapsed_str(result.elapsed()) if ((result.expected_fail and result.status != 'FAIL') or (not result.expected_fail and result.status == 'FAIL')): show_msg = True else: show_msg = False if (self.verbose == 0 and (result.err_msg and show_msg)) or self.verbose > 0: if result.mpi and result.nprocs > 0: run_type = '(mpi) ' elif result.isolated: run_type = '(isolated) ' else: run_type = '' if result.err_msg: stream.write("%s%s ... %s (%s, %d MB)\n%s\n" % (run_type, result.spec, result.status, stats, result.memory_usage, result.err_msg)) else: stream.write("%s%s ... %s (%s, %d MB)\n" % (run_type, result.spec, result.status, stats, result.memory_usage)) else: stream.write(_result_map[(result.status, result.expected_fail)]) if self.options.pre_announce: stream.write('\n') stream.flush()
def _print_result(self, result): stream = self.stream stats = elapsed_str(result.elapsed()) if result.mpi and result.nprocs > 0: run_type = '(mpi) ' elif result.isolated: run_type = '(isolated) ' else: run_type = '' if self.verbose or (result.err_msg and result.status in ('SKIP', 'FAIL')): if result.err_msg: stream.write("%s%s ... %s (%s, %d MB)\n%s\n" % ( run_type, result.spec, result.status, stats, result.memory_usage, result.err_msg)) else: stream.write("%s%s ... %s (%s, %d MB)\n" % ( run_type, result.spec, result.status, stats, result.memory_usage)) else: stream.write(_result_map[result.status]) stream.flush()
def get_iter(self, input_iter): oks = 0 total = 0 fails = [] skips = [] test_sum_time = 0. write = self.stream.write for test in input_iter: total += 1 if test.status == 'OK': if test.expected_fail: fails.append(test.short_name()) else: oks += 1 test_sum_time += (test.end_time-test.start_time) elif test.status == 'FAIL': if test.expected_fail: oks += 1 else: fails.append(test.short_name()) test_sum_time += (test.end_time-test.start_time) elif test.status == 'SKIP': skips.append(test.short_name()) yield test # now summarize the run if skips and self.options.verbose: # only list skips in verbose mode write("\n\nThe following tests were skipped:\n") for s in sorted(skips): write(s) write('\n') if fails: write("\n\nThe following tests failed:\n") for f in sorted(fails): write(f) write('\n') else: write("\n\nOK") write("\n\nPassed: %d\nFailed: %d\nSkipped: %d\n" % (oks, len(fails), len(skips))) wallclock = time.time() - self._start_time s = "" if total == 1 else "s" if self.options.isolated: procstr = " in isolated processes" else: procstr = " using %d processes" % self.options.num_procs write("\n\nRan %d test%s%s\nWall clock time: %s\n\n" % (total, s, procstr, elapsed_str(wallclock)))
def _print_result(self, result): stream = self.stream stats = elapsed_str(result.elapsed()) if ((result.expected_fail and result.status != 'FAIL') or (not result.expected_fail and result.status == 'FAIL')): show_msg = True else: show_msg = False if (self.verbose == 0 and (result.err_msg and show_msg)) or self.verbose > 0: if result.mpi and result.nprocs > 0: run_type = '(mpi) ' elif result.isolated: run_type = '(isolated) ' else: run_type = '' if result.err_msg: stream.write("%s%s ... %s (%s, %d MB)\n%s\n" % ( run_type, result.spec, result.status, stats, result.memory_usage, result.err_msg)) else: stream.write("%s%s ... %s (%s, %d MB)\n" % ( run_type, result.spec, result.status, stats, result.memory_usage)) else: stream.write(_result_map[(result.status, result.expected_fail)]) stream.flush()
def get_iter(self, input_iter): oks = 0 total = 0 fails = [] skips = [] test_sum_time = 0. write = self.stream.write for test in input_iter: total += 1 if test.status == 'OK': if test.expected_fail: fails.append(self.get_test_name(test)) else: oks += 1 test_sum_time += (test.end_time-test.start_time) elif test.status == 'FAIL': if test.expected_fail: oks += 1 else: fails.append(self.get_test_name(test)) test_sum_time += (test.end_time-test.start_time) elif test.status == 'SKIP': skips.append(self.get_test_name(test)) yield test # now summarize the run if skips and self.options.verbose: # only list skips in verbose mode write("\n\nThe following tests were skipped:\n") for s in sorted(skips): write(s) write('\n') if fails: write("\n\nThe following tests failed:\n") for f in sorted(fails): write(f) write('\n') else: write("\n\nOK") write("\n\nPassed: %d\nFailed: %d\nSkipped: %d\n" % (oks, len(fails), len(skips))) wallclock = time.time() - self._start_time s = "" if total == 1 else "s" if self.options.isolated: procstr = " in isolated processes" else: procstr = " using %d processes" % self.options.num_procs write("\n\nRan %d test%s%s\nWall clock time: %s\n\n" % (total, s, procstr, elapsed_str(wallclock))) if fails: sys_info = platform.uname() write("\nYour system's specifications are shown below " "to facilitate reporting of failures.") write("\n\nOS: %s\nCPU: %s\nPython: %s\n\n" % ("%s | %s" % (sys_info.system, sys_info.version), "%s | %s" % (sys_info.machine, sys_info.processor), sys.version))