proctor-checkins Mailing List for Proctor
Status: Alpha
Brought to you by:
doughellmann
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(40) |
Jul
(10) |
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(4) |
Dec
(10) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Doug H. <dou...@us...> - 2006-09-19 14:04:53
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10689 Modified Files: runner.py Log Message: do not print message when GC is disabled Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** runner.py 15 Sep 2006 15:10:29 -0000 1.15 --- runner.py 19 Sep 2006 14:04:50 -0000 1.16 *************** *** 215,220 **** # collect again without DEBUG_LEAK gc.collect() ! else: ! print 'GC: disabled' return --- 215,220 ---- # collect again without DEBUG_LEAK gc.collect() ! #else: ! # print 'GC: disabled' return |
From: Doug H. <dou...@us...> - 2006-09-15 15:10:34
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23113/proctorlib Modified Files: cui.py runner.py Log Message: Add --no-gc option; enable gc by default Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** cui.py 1 May 2006 12:47:22 -0000 1.20 --- cui.py 15 Sep 2006 15:10:29 -0000 1.21 *************** *** 55,58 **** --- 55,59 ---- # Import system modules # + import gc import string import sys *************** *** 94,97 **** --- 95,102 ---- interleaved = False category = 'All' + + def appInit(self): + gc.enable() + return def optionHandler_list(self): *************** *** 157,160 **** --- 162,171 ---- return + def optionHandler_no_gc(self): + """Disable garbage collection and leak reporting. + """ + gc.disable() + return + def showNode(self, node, data=None): num_node_tests = node.getTestSuite(0).countTestCases() Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** runner.py 16 Jun 2006 17:45:49 -0000 1.14 --- runner.py 15 Sep 2006 15:10:29 -0000 1.15 *************** *** 59,62 **** --- 59,63 ---- except: from StringIO import StringIO + import gc import sys import time *************** *** 74,77 **** --- 75,79 ---- # from proctorlib.trace import trace + from proctorlib import scanner # *************** *** 161,168 **** return def stopTest(self, test): trace.into('ProctorTestResult', 'stopTest', test=test) ! unittest.TestResult.stopTest(self, test) trace.outof() --- 163,231 ---- return + def _showGarbage(self): + """ + show us what's the garbage about + """ + if gc.isenabled(): + # + # Save the current settings + # + flags = gc.get_debug() + th = gc.get_threshold() + #sys.stderr.write("GC: Thresholds = %s\n" % str(th)) + + try: + # + # Perform aggressive collection + # + gc.set_debug(gc.DEBUG_LEAK) + gc.set_threshold(1, 1, 1) + # force collection + sys.stderr.write("GC: Collecting...\n") + for i in range(6): + gc.collect() + + # + # Remember what is garbage now + # + garbage = gc.garbage + finally: + gc.set_debug(flags) + gc.set_threshold(*th) + + # + # Report on current garbage + # + if not garbage: + sys.stderr.write('GC: no garbage\n') + else: + sys.stderr.write("GC: Garbage objects:\n") + for x in garbage: + for c in [ scanner.ModuleTree, + ]: + if isinstance(x, c): + # ignore + continue + + s = str(x) + #if len(s) > 80: s = s[:80] + sys.stderr.write(str(type(x))) + sys.stderr.write("\n %s\n" % s) + + # collect again without DEBUG_LEAK + gc.collect() + else: + print 'GC: disabled' + return + def stopTest(self, test): trace.into('ProctorTestResult', 'stopTest', test=test) ! unittest.TestResult.stopTest(self, test) + + try: + self._showGarbage() + except Exception, err: + print 'GC ERROR: ', err trace.outof() |
From: Doug H. <dou...@us...> - 2006-06-16 17:45:54
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20227/proctorlib Modified Files: runner.py Log Message: Preserve a reference to sys.stdout for our output, since a test might replace it Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** runner.py 1 May 2006 12:48:08 -0000 1.13 --- runner.py 16 Jun 2006 17:45:49 -0000 1.14 *************** *** 66,69 **** --- 66,74 ---- # + # Preserve stdout in case some test overrides it + # + STDOUT=sys.stdout + + # # Import Local modules # *************** *** 106,114 **** elapsed_time = float(self.end_time - self.start_time) ! print ! print "Ran %d test%s in %.3fs" % (run, ! run == 1 and "" or "s", ! elapsed_time) ! print if not self.wasSuccessful(): --- 111,119 ---- elapsed_time = float(self.end_time - self.start_time) ! STDOUT.write('\n') ! STDOUT.write("Ran %d test%s in %.3fs\n" % (run, ! run == 1 and "" or "s", ! elapsed_time)) ! STDOUT.write('\n') if not self.wasSuccessful(): *************** *** 131,138 **** errors = '' ! print "FAILED (%s%s)" % (failures, errors) else: ! print "OK" return --- 136,143 ---- errors = '' ! STDOUT.write("FAILED (%s%s)\n" % (failures, errors)) else: ! STDOUT.write("OK\n") return *************** *** 148,153 **** desc, ) ! print progress_line, ! sys.stdout.flush() self.num_tests_run += 1 --- 153,158 ---- desc, ) ! STDOUT.write(progress_line) ! STDOUT.flush() self.num_tests_run += 1 *************** *** 239,245 **** trace.into('TestResult', 'addError', test=test, err=err) unittest.TestResult.addError(self, test, err) ! print 'ERROR in', test.id() ! print self._exc_info_to_string(err, test) ! sys.stdout.flush() trace.outof() return --- 244,251 ---- trace.into('TestResult', 'addError', test=test, err=err) unittest.TestResult.addError(self, test, err) ! STDOUT.write('ERROR in %s\n' % test.id()) ! STDOUT.write(self._exc_info_to_string(err, test)) ! STDOUT.write('\n') ! STDOUT.flush() trace.outof() return *************** *** 248,255 **** trace.into('TestResult', 'addFailure', test=test, err=err) unittest.TestResult.addFailure(self, test, err) ! print 'FAIL in', test.id() ! print self._exc_info_to_string(err, test) ! print ! sys.stdout.flush() trace.outof() return --- 254,261 ---- trace.into('TestResult', 'addFailure', test=test, err=err) unittest.TestResult.addFailure(self, test, err) ! STDOUT.write('FAIL in %s\n' % test.id()) ! STDOUT.write(self._exc_info_to_string(err, test)) ! STDOUT.write('\n') ! STDOUT.flush() trace.outof() return *************** *** 259,264 **** unittest.TestResult.addSuccess(self, test) ! print 'ok' ! sys.stdout.flush() trace.outof() --- 265,270 ---- unittest.TestResult.addSuccess(self, test) ! STDOUT.write('ok\n') ! STDOUT.flush() trace.outof() *************** *** 286,292 **** def _outputSeparator(self, message): ! print '%s %s' % (self.PREFIX, message) ! print ! sys.stdout.flush() return --- 292,297 ---- def _outputSeparator(self, message): ! STDOUT.write('%s %s\n\n' % (self.PREFIX, message)) ! STDOUT.flush() return *************** *** 296,301 **** unittest.TestResult.startTest(self, test) ! print test.id() ! sys.stdout.flush() self.num_tests_run += 1 --- 301,306 ---- unittest.TestResult.startTest(self, test) ! STDOUT.write('%s\n' % test.id()) ! STDOUT.flush() self.num_tests_run += 1 *************** *** 314,320 **** self.num_tests, ) ! print progress_line self._outputSeparator('End progress') ! sys.stdout.flush() return --- 319,327 ---- self.num_tests, ) ! STDOUT.write(progress_line) ! STDOUT.write('\n') ! self._outputSeparator('End progress') ! STDOUT.flush() return *************** *** 324,340 **** self._outputSeparator('Start results') ! print 'ok' self._outputSeparator('End results') ! sys.stdout.flush() return def addError(self, test, err): unittest.TestResult.addError(self, test, err) ! print self._exc_info_to_string(err, test) self._outputSeparator('Start results') ! print 'ERROR in', test.id() self._outputSeparator('End results') ! sys.stdout.flush() return --- 331,348 ---- self._outputSeparator('Start results') ! STDOUT.write('ok\n') self._outputSeparator('End results') ! STDOUT.flush() return def addError(self, test, err): unittest.TestResult.addError(self, test, err) ! STDOUT.write(self._exc_info_to_string(err, test)) ! STDOUT.write('\n') self._outputSeparator('Start results') ! STDOUT.write('ERROR in %s\n' % test.id()) self._outputSeparator('End results') ! STDOUT.flush() return *************** *** 342,351 **** unittest.TestResult.addFailure(self, test, err) ! print self._exc_info_to_string(err, test) self._outputSeparator('Start results') ! print 'FAIL in', test.id() self._outputSeparator('End results') ! sys.stdout.flush() return --- 350,359 ---- unittest.TestResult.addFailure(self, test, err) ! STDOUT.write(self._exc_info_to_string(err, test)) self._outputSeparator('Start results') ! STDOUT.write('FAIL in %s\n' % test.id()) self._outputSeparator('End results') ! STDOUT.flush() return *************** *** 357,366 **** num_errors = len(self.errors) ! print 'Failures: %d' % num_failures ! print 'Errors: %d' % num_errors successes = (self.num_tests - (num_failures + num_errors)) ! print 'Successes: %d' % successes ! print 'Tests: %d' % self.num_tests_run ! print 'Elapsed time (sec): %.3f' % elapsed_time if num_failures or num_errors: --- 365,374 ---- num_errors = len(self.errors) ! STDOUT.write('Failures: %d\n' % num_failures) ! STDOUT.write('Errors: %d\n' % num_errors) successes = (self.num_tests - (num_failures + num_errors)) ! STDOUT.write('Successes: %d\n' % successes) ! STDOUT.write('Tests: %d\n' % self.num_tests_run) ! STDOUT.write('Elapsed time (sec): %.3f\n' % elapsed_time) if num_failures or num_errors: *************** *** 369,376 **** status = 'OK' ! print 'Status: %s' % status self._outputSeparator('End summary') ! sys.stdout.flush() return --- 377,384 ---- status = 'OK' ! STDOUT.write('Status: %s\n' % status) self._outputSeparator('End summary') ! STDOUT.flush() return |
From: Doug H. <dou...@us...> - 2006-05-01 12:48:34
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1709 Modified Files: runner.py Log Message: Include test name in error and failure reporting Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** runner.py 17 Apr 2005 13:50:42 -0000 1.12 --- runner.py 1 May 2006 12:48:08 -0000 1.13 *************** *** 239,243 **** trace.into('TestResult', 'addError', test=test, err=err) unittest.TestResult.addError(self, test, err) ! print 'ERROR' print self._exc_info_to_string(err, test) sys.stdout.flush() --- 239,243 ---- trace.into('TestResult', 'addError', test=test, err=err) unittest.TestResult.addError(self, test, err) ! print 'ERROR in', test.id() print self._exc_info_to_string(err, test) sys.stdout.flush() *************** *** 248,252 **** trace.into('TestResult', 'addFailure', test=test, err=err) unittest.TestResult.addFailure(self, test, err) ! print 'FAIL' print self._exc_info_to_string(err, test) print --- 248,252 ---- trace.into('TestResult', 'addFailure', test=test, err=err) unittest.TestResult.addFailure(self, test, err) ! print 'FAIL in', test.id() print self._exc_info_to_string(err, test) print *************** *** 334,338 **** self._outputSeparator('Start results') ! print 'ERROR' self._outputSeparator('End results') sys.stdout.flush() --- 334,338 ---- self._outputSeparator('Start results') ! print 'ERROR in', test.id() self._outputSeparator('End results') sys.stdout.flush() *************** *** 345,349 **** self._outputSeparator('Start results') ! print 'FAIL' self._outputSeparator('End results') sys.stdout.flush() --- 345,349 ---- self._outputSeparator('Start results') ! print 'FAIL in', test.id() self._outputSeparator('End results') sys.stdout.flush() |
From: Doug H. <dou...@us...> - 2006-05-01 12:47:36
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1010 Modified Files: cui.py Log Message: Update to work with the new coverage module Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cui.py 4 May 2003 22:37:22 -0000 1.19 --- cui.py 1 May 2006 12:47:22 -0000 1.20 *************** *** 66,69 **** --- 66,70 ---- # import proctorlib + import proctorlib.coverage from proctorlib.trace import trace *************** *** 84,94 **** shortArgumentsDescription = "[<directory name> ...]" ! list_mode = 0 ! list_categories_mode = 0 ! run_mode = 1 ! parsable_mode = 0 ! coverage_filename = None ! coverage = 1 ! interleaved = 0 category = 'All' --- 85,96 ---- shortArgumentsDescription = "[<directory name> ...]" ! list_mode = False ! list_categories_mode = False ! run_mode = True ! parsable_mode = False ! coverage_filename = proctorlib.coverage.coverage.cache_default ! coverage = True ! coverage_exclude_patterns = [] ! interleaved = False category = 'All' *************** *** 96,100 **** """List tests. """ ! self.list_mode = 1 return --- 98,102 ---- """List tests. """ ! self.list_mode = True return *************** *** 102,106 **** """List test categories. """ ! self.list_categories_mode = 1 return --- 104,108 ---- """List test categories. """ ! self.list_categories_mode = True return *************** *** 108,112 **** """Do not run the tests """ ! self.run_mode = 0 return --- 110,114 ---- """Do not run the tests """ ! self.run_mode = False return *************** *** 125,129 **** with the test list. """ ! self.interleaved = 1 return --- 127,131 ---- with the test list. """ ! self.interleaved = True return *************** *** 131,136 **** """Format output to make it easier to parse. """ ! self.interleaved = 1 ! self.parsable_mode = 1 return --- 133,138 ---- """Format output to make it easier to parse. """ ! self.interleaved = True ! self.parsable_mode = True return *************** *** 144,148 **** """Disable coverage analysis. """ ! self.coverage = 0 return --- 146,158 ---- """Disable coverage analysis. """ ! self.coverage = False ! return ! ! def optionHandler_coverage_exclude(self, pattern): ! """Add a line exclude pattern ! (can be a regular expression). ! """ ! self.statusMessage('Excluding "%s" from coverage analysis' % pattern) ! self.coverage_exclude_patterns.append(pattern) return *************** *** 260,264 **** # print that here. # ! if self.list_categories_mode: success = self.listCategories(module_tree) --- 270,274 ---- # print that here. # ! elif self.list_categories_mode: success = self.listCategories(module_tree) *************** *** 267,271 **** # last. # ! if self.run_mode: # --- 277,281 ---- # last. # ! elif self.run_mode: # *************** *** 273,276 **** --- 283,287 ---- # if self.coverage_filename: + self.statusMessage('Writing coverage output to %s' % self.coverage_filename) import os os.environ['COVERAGE_FILE'] = self.coverage_filename *************** *** 278,290 **** if self.coverage: # ! # Wait to do the import of this module until right here, ! # in case the filename was specified via the command line. ! # An API to the coverage module would be nice... # ! from proctorlib import coverage # # Start code coverage counter # ! coverage.start() # --- 289,304 ---- if self.coverage: # ! # Clean up in case we have previous coverage data # ! proctorlib.coverage.erase() ! # ! # Add exclude patterns ! # ! for pattern in self.coverage_exclude_patterns: ! proctorlib.coverage.exclude(pattern) # # Start code coverage counter # ! proctorlib.coverage.start() # *************** *** 304,309 **** # Stop coverage counter and save its results # ! coverage.stop() ! coverage.the_coverage.save() # --- 318,323 ---- # Stop coverage counter and save its results # ! proctorlib.coverage.stop() ! proctorlib.coverage.the_coverage.save() # |
From: Doug H. <dou...@us...> - 2006-05-01 12:28:35
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18609 Modified Files: coverage.py Log Message: Update to latest coverage.py from http://www.nedbatchelder.com/code/modules/coverage.html Index: coverage.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/coverage.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** coverage.py 23 Oct 2002 17:18:49 -0000 1.2 --- coverage.py 1 May 2006 12:28:25 -0000 1.3 *************** *** 7,10 **** --- 7,12 ---- # # Gareth Rees, Ravenbrook Limited, 2001-12-04 + # Ned Batchelder, 2004-12-12 + # http://nedbatchelder.com/code/modules/coverage.html # # *************** *** 30,38 **** Erase collected coverage data. [...992 lines suppressed...] + # + # 2005-12-03 NMB coverage.py can now measure itself. + # + # 2005-12-04 NMB Adapted Greg Rogers' patch for using relative filenames, + # and sorting and omitting files to report on. # # C. COPYRIGHT AND LICENCE # # Copyright 2001 Gareth Rees. All rights reserved. + # Copyright 2004-2005 Ned Batchelder. All rights reserved. # # Redistribution and use in source and binary forms, with or without *************** *** 601,605 **** # DAMAGE. # - # - # # $Id$ --- 889,891 ---- |
From: Doug H. <dou...@us...> - 2005-04-17 13:50:51
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2815/proctorlib Modified Files: runner.py Log Message: Re-establish TestResult manipulation for interleaved mode to get the right summary Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** runner.py 17 Apr 2005 13:46:58 -0000 1.11 --- runner.py 17 Apr 2005 13:50:42 -0000 1.12 *************** *** 238,242 **** def addError(self, test, err): trace.into('TestResult', 'addError', test=test, err=err) ! #unittest.TestResult.addError(self, test, err) print 'ERROR' print self._exc_info_to_string(err, test) --- 238,242 ---- def addError(self, test, err): trace.into('TestResult', 'addError', test=test, err=err) ! unittest.TestResult.addError(self, test, err) print 'ERROR' print self._exc_info_to_string(err, test) *************** *** 247,251 **** def addFailure(self, test, err): trace.into('TestResult', 'addFailure', test=test, err=err) ! #unittest.TestResult.addFailure(self, test, err) print 'FAIL' print self._exc_info_to_string(err, test) --- 247,251 ---- def addFailure(self, test, err): trace.into('TestResult', 'addFailure', test=test, err=err) ! unittest.TestResult.addFailure(self, test, err) print 'FAIL' print self._exc_info_to_string(err, test) |
From: Doug H. <dou...@us...> - 2005-04-17 13:47:07
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv793/proctorlib Modified Files: runner.py Log Message: Fix _exc_info_to_string() usage for Python 2.4 std library version of unittest.py. Add flush calls. Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** runner.py 16 Apr 2005 00:00:25 -0000 1.10 --- runner.py 17 Apr 2005 13:46:58 -0000 1.11 *************** *** 149,152 **** --- 149,153 ---- ) print progress_line, + sys.stdout.flush() self.num_tests_run += 1 *************** *** 228,237 **** return list ! def _exc_info_to_string(self, err): ! """Converts a sys.exc_info()-style tuple of values into a string.""" ! #err_class, err_inst, tb = err ! #formated_exception = self._format_list(traceback.extract_tb(tb, None)) ! formated_exception = traceback.format_exception(*err) ! return ''.join(formated_exception) def addError(self, test, err): --- 229,238 ---- return list ! #def _exc_info_to_string(self, err): ! # """Converts a sys.exc_info()-style tuple of values into a string.""" ! # #err_class, err_inst, tb = err ! # #formated_exception = self._format_list(traceback.extract_tb(tb, None)) ! # formated_exception = traceback.format_exception(*err) ! # return ''.join(formated_exception) def addError(self, test, err): *************** *** 239,243 **** #unittest.TestResult.addError(self, test, err) print 'ERROR' ! print self._exc_info_to_string(err) trace.outof() return --- 240,245 ---- #unittest.TestResult.addError(self, test, err) print 'ERROR' ! print self._exc_info_to_string(err, test) ! sys.stdout.flush() trace.outof() return *************** *** 247,252 **** #unittest.TestResult.addFailure(self, test, err) print 'FAIL' ! print self._exc_info_to_string(err) print trace.outof() return --- 249,255 ---- #unittest.TestResult.addFailure(self, test, err) print 'FAIL' ! print self._exc_info_to_string(err, test) print + sys.stdout.flush() trace.outof() return *************** *** 257,260 **** --- 260,264 ---- unittest.TestResult.addSuccess(self, test) print 'ok' + sys.stdout.flush() trace.outof() *************** *** 284,287 **** --- 288,292 ---- print '%s %s' % (self.PREFIX, message) print + sys.stdout.flush() return *************** *** 292,295 **** --- 297,301 ---- print test.id() + sys.stdout.flush() self.num_tests_run += 1 *************** *** 310,313 **** --- 316,320 ---- print progress_line self._outputSeparator('End progress') + sys.stdout.flush() return *************** *** 319,331 **** print 'ok' self._outputSeparator('End results') return def addError(self, test, err): unittest.TestResult.addError(self, test, err) ! print self._exc_info_to_string(err) self._outputSeparator('Start results') print 'ERROR' self._outputSeparator('End results') return --- 326,340 ---- print 'ok' self._outputSeparator('End results') + sys.stdout.flush() return def addError(self, test, err): unittest.TestResult.addError(self, test, err) ! print self._exc_info_to_string(err, test) self._outputSeparator('Start results') print 'ERROR' self._outputSeparator('End results') + sys.stdout.flush() return *************** *** 333,341 **** unittest.TestResult.addFailure(self, test, err) ! print self._exc_info_to_string(err) self._outputSeparator('Start results') print 'FAIL' self._outputSeparator('End results') return --- 342,351 ---- unittest.TestResult.addFailure(self, test, err) ! print self._exc_info_to_string(err, test) self._outputSeparator('Start results') print 'FAIL' self._outputSeparator('End results') + sys.stdout.flush() return *************** *** 362,365 **** --- 372,376 ---- self._outputSeparator('End summary') + sys.stdout.flush() return |
From: Doug H. <dou...@us...> - 2005-04-16 00:00:35
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5782/proctorlib Modified Files: runner.py Log Message: Update to work with Python 2.4 Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** runner.py 8 Sep 2004 14:55:15 -0000 1.9 --- runner.py 16 Apr 2005 00:00:25 -0000 1.10 *************** *** 237,241 **** def addError(self, test, err): trace.into('TestResult', 'addError', test=test, err=err) ! unittest.TestResult.addError(self, test, err) print 'ERROR' print self._exc_info_to_string(err) --- 237,241 ---- def addError(self, test, err): trace.into('TestResult', 'addError', test=test, err=err) ! #unittest.TestResult.addError(self, test, err) print 'ERROR' print self._exc_info_to_string(err) *************** *** 245,249 **** def addFailure(self, test, err): trace.into('TestResult', 'addFailure', test=test, err=err) ! unittest.TestResult.addFailure(self, test, err) print 'FAIL' print self._exc_info_to_string(err) --- 245,249 ---- def addFailure(self, test, err): trace.into('TestResult', 'addFailure', test=test, err=err) ! #unittest.TestResult.addFailure(self, test, err) print 'FAIL' print self._exc_info_to_string(err) |
From: Doug H. <dou...@us...> - 2004-09-08 14:56:20
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11298/proctorlib Modified Files: scanner.py Log Message: Show items which are being skipped. Index: scanner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/scanner.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** scanner.py 29 Jan 2003 23:27:40 -0000 1.20 --- scanner.py 8 Sep 2004 14:56:10 -0000 1.21 *************** *** 473,476 **** --- 473,479 ---- for skip_name in skip_names: if skip_name in filenames: + if self.verbose_level: + print 'Skipping: %s' % skip_name + sys.stdout.flush() trace.write('Skipping %s' % skip_name, outputLevel=self.TRACE_LEVEL) del filenames[filenames.index(skip_name)] |
From: Doug H. <dou...@us...> - 2004-09-08 14:55:24
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11093/proctorlib Modified Files: runner.py Log Message: Convert progress lines to show the id of the test instead of the description. Update exception formatting. Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** runner.py 18 Dec 2003 22:20:43 -0000 1.8 --- runner.py 8 Sep 2004 14:55:15 -0000 1.9 *************** *** 55,59 **** # Import system modules # - import string try: from cStringIO import StringIO --- 55,58 ---- *************** *** 63,66 **** --- 62,66 ---- import time import traceback + import types import unittest *************** *** 73,76 **** --- 73,81 ---- # Module # + def _some_str(value): + try: + return str(value) + except: + return '<unprintable %s object>' % type(value).__name__ class ProctorTestResult(unittest.TestResult): *************** *** 138,142 **** unittest.TestResult.startTest(self, test) ! desc = test.shortDescription() or str(test) progress_line = '%3d/%3d %s ...' % (self.num_tests_run, self.num_tests, --- 143,147 ---- unittest.TestResult.startTest(self, test) ! desc = test.id() progress_line = '%3d/%3d %s ...' % (self.num_tests_run, self.num_tests, *************** *** 158,164 **** return def _exc_info_to_string(self, err): """Converts a sys.exc_info()-style tuple of values into a string.""" ! return string.join(apply(traceback.format_exception, err), '') def addError(self, test, err): --- 163,237 ---- return + def _format_exception_only(self, etype, value, *args): + """Format the exception part of a traceback as the output of grep. + + The arguments are the exception type and value such as given by + sys.last_type and sys.last_value. The return value is a list of + strings, each ending in a newline. Normally, the list contains a + single string; however, for SyntaxError exceptions, it contains + several lines that (when printed) display detailed information + about where the syntax error occurred. The message indicating + which exception occurred is the always last string in the list. + """ + list = [] + if type(etype) == types.ClassType: + stype = etype.__name__ + else: + stype = etype + + if value is None: + list.append('%s\n' % str(stype)) + else: + if etype is SyntaxError: + try: + msg, (filename, lineno, offset, line) = value + except: + pass + else: + if not filename: filename = "<string>" + if line is not None: + i = 0 + while i < len(line) and line[i].isspace(): + i = i+1 + list.append('%s:%d:%s\n' % (filename, lineno, line.strip())) + if offset is not None: + s = ' ' + for c in line[i:offset-1]: + if c.isspace(): + s = s + c + else: + s = s + ' ' + list.append('%s^\n' % s) + value = msg + s = _some_str(value) + if s: + list.append('%s: %s\n' % (str(stype), s)) + else: + list.append('%s\n' % str(stype)) + + return list + + def _format_list(self, extracted_list): + """Format a list of traceback entry tuples for printing. + + Given a list of tuples as returned by extract_tb() or + extract_stack(), return a list of strings ready for printing. + Each string in the resulting list corresponds to the item with the + same index in the argument list. Each string ends in a newline; + the strings may contain internal newlines as well, for those items + whose source text line is not None. + """ + list = [] + for filename, lineno, name, line in extracted_list: + item = '%s:%d:%s:%s\n' % (filename,lineno,line.strip(),name) + list.append(item) + return list + def _exc_info_to_string(self, err): """Converts a sys.exc_info()-style tuple of values into a string.""" ! #err_class, err_inst, tb = err ! #formated_exception = self._format_list(traceback.extract_tb(tb, None)) ! formated_exception = traceback.format_exception(*err) ! return ''.join(formated_exception) def addError(self, test, err): |
From: Doug H. <dou...@us...> - 2003-12-18 22:20:46
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv24915 Modified Files: runner.py Log Message: Be less obscure. Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** runner.py 4 May 2003 22:37:22 -0000 1.7 --- runner.py 18 Dec 2003 22:20:43 -0000 1.8 *************** *** 109,113 **** if not self.wasSuccessful(): ! failed, errored = map(len, (self.failures, self.errors)) if failed: --- 109,115 ---- if not self.wasSuccessful(): ! #failed, errored = map(len, (self.failures, self.errors)) ! failed = len(self.failures) ! errored = len(self.errors) if failed: |
From: Doug H. <dou...@us...> - 2003-05-04 22:37:25
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv1108/proctorlib Modified Files: cui.py runner.py Log Message: Move all of the parsable output handling stuff out of the CLI and into the ProctorParsableTestResult class so it can be shared with the BackgroundTestRunner. Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** cui.py 23 Apr 2003 12:20:43 -0000 1.18 --- cui.py 4 May 2003 22:37:22 -0000 1.19 *************** *** 105,109 **** return ! def optionHandler_norun(self): """Do not run the tests """ --- 105,109 ---- return ! def optionHandler_no_run(self): """Do not run the tests """ *************** *** 156,223 **** return - def showTestBegin(self, test): - trace.into('proctorbatch', 'showTestBegin', test=test) - desc = test.shortDescription() or str(test) - if self.parsable_mode: - print - print '*** begin test' - - self.num_tests_run += 1 - - progress_line = '%3d/%3d %s ...' % (self.num_tests_run, - self.num_tests, - desc, - ) - - print progress_line, - trace.outof() - return - - def showTestEnd(self, test): - trace.into('proctorbatch', 'showTestEnd', test=test) - if self.parsable_mode: - print '*** end test' - trace.outof() - return - - def showTestSuccess(self, test): - trace.into('proctorbatch', 'showTestSuccess', test=test) - print 'ok' - trace.outof() - return - - def showTestFailure(self, test, err): - trace.into('proctorbatch', 'showTestFailure', test=test, err=err) - print 'FAIL' - print self._exc_info_to_string(err) - print - trace.outof() - return - - def showTestError(self, test, err): - trace.into('proctorbatch', 'showTestError', test=test, err=err) - print 'ERROR' - print self._exc_info_to_string(err) - trace.outof() - return - - def _exc_info_to_string(self, err): - """Converts a sys.exc_info()-style tuple of values into a string.""" - return string.join(apply(traceback.format_exception, err), '') - def runTests(self, module_tree): - start_time = time.time() - if self.parsable_mode: - print '*** start run' - elif self.verboseLevel: - print - test_suite = module_tree.getTestSuite(full=1, category=self.category) if self.interleaved: ! test_runner = proctorlib.runner.TestRunner(self) else: - verbosity = self.verboseLevel + 1 test_runner = unittest.TextTestRunner(descriptions=0, verbosity=verbosity) --- 156,176 ---- return def runTests(self, module_tree): test_suite = module_tree.getTestSuite(full=1, category=self.category) + verbosity = self.verboseLevel + 1 + if self.interleaved: ! if self.parsable_mode: ! result_factory = proctorlib.runner.ProctorParsableTestResult ! else: ! result_factory = proctorlib.runner.ProctorTestResult ! ! test_runner = proctorlib.runner.TestRunner( ! verbosity=verbosity, ! resultFactory=result_factory, ! ) else: test_runner = unittest.TextTestRunner(descriptions=0, verbosity=verbosity) *************** *** 226,280 **** # Set up progress management info. # - self.num_tests = test_suite.countTestCases() - self.num_tests_run = 0 - result = test_runner.run(test_suite) - run = result.testsRun - end_time = time.time() - - elapsed_time = float(end_time - start_time) - - if self.parsable_mode: - print - print '*** begin summary' - - if self.interleaved or self.parsable_mode: - # - # If we are running verbosely, the test runner will - # print the summary. Otherwise, we want to do it - # ourselves. - # - - print - print "Ran %d test%s in %.3fs" % (run, run == 1 and "" or "s", elapsed_time) - print - - if not result.wasSuccessful(): - - failed, errored = map(len, (result.failures, result.errors)) - - if failed: - failures = "failures=%d" % failed - else: - failures = '' - - if errored: - if failed: - errors = ", errors=%d" % errored - else: - errors = "errors=%d" % errored - else: - errors = '' - - print "FAILED (%s%s)" % (failures, errors) - - else: - print "OK" - - if self.parsable_mode: - print '*** end summary' - print '*** end run' - return result --- 179,184 ---- *************** *** 287,295 **** #self.statusMessage('data=%s' % data) if self.parsable_mode: ! desc = '<%s)' % (node.shortDescription() or '') else: desc = node.shortDescription() or '' if desc: ! desc = '<%s)' % desc id = node.id() print '%s %s' % (id, desc) --- 191,199 ---- #self.statusMessage('data=%s' % data) if self.parsable_mode: ! desc = '(%s)' % (node.shortDescription() or '') else: desc = node.shortDescription() or '' if desc: ! desc = '(%s)' % desc id = node.id() print '%s %s' % (id, desc) *************** *** 300,304 **** #moduleTree.walk(self._showTestInfo, None) if self.parsable_mode: ! print '*** Start list' suite = moduleTree.getTestSuite(1, category=self.category) for test in suite._tests: --- 204,208 ---- #moduleTree.walk(self._showTestInfo, None) if self.parsable_mode: ! print '__PROCTOR__ Start list' suite = moduleTree.getTestSuite(1, category=self.category) for test in suite._tests: *************** *** 306,310 **** success = 1 if self.parsable_mode: ! print '*** End list' return success --- 210,214 ---- success = 1 if self.parsable_mode: ! print '__PROCTOR__ End list' return success *************** *** 343,355 **** sys.argv = [ sys.argv[0] ] if self.list_mode: - module_tree = self.getModuleTree(args) success = self.listTests(module_tree) ! elif self.list_categories_mode: ! module_tree = self.getModuleTree(args) success = self.listCategories(module_tree) ! elif self.run_mode: # --- 247,271 ---- sys.argv = [ sys.argv[0] ] + module_tree = self.getModuleTree(args) + + # + # If they asked for a list of the tests, print that + # first. + # if self.list_mode: success = self.listTests(module_tree) ! # ! # If they asked for a list of test categories, ! # print that here. ! # ! if self.list_categories_mode: success = self.listCategories(module_tree) ! # ! # If they asked to have tests run, do that ! # last. ! # ! if self.run_mode: # Index: runner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/runner.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** runner.py 21 Jul 2002 20:42:43 -0000 1.6 --- runner.py 4 May 2003 22:37:22 -0000 1.7 *************** *** 61,64 **** --- 61,65 ---- from StringIO import StringIO import sys + import time import traceback import unittest *************** *** 75,100 **** class ProctorTestResult(unittest.TestResult): ! def __init__(self, app): trace.into('ProctorTestResult', '__init__') ! self.app = app ! self.outputs = {} ! self.output_trap = None ! # ! # Save stdout and stderr handles, since we'll be ! # replacing them later. ! # ! self.stdout = sys.stdout ! self.stderr = sys.stderr unittest.TestResult.__init__(self) trace.outof() return def startTest(self, test): trace.into('ProctorTestResult', 'startTest', test=test) ! self.output_trap = StringIO() ! #sys.stdout = self.output_trap ! #sys.stderr = self.output_trap unittest.TestResult.startTest(self, test) ! self.app.showTestBegin(test) trace.outof() return --- 76,148 ---- class ProctorTestResult(unittest.TestResult): ! def __init__(self, testSuite, verbosity): trace.into('ProctorTestResult', '__init__') ! ! self.num_tests = testSuite.countTestCases() ! self.num_tests_run = 0 ! self.verbosity = verbosity ! unittest.TestResult.__init__(self) + trace.outof() return + + def startRun(self): + self.start_time = time.time() + return + + def endRun(self): + self.end_time = time.time() + return + + def showSummary(self): + run = self.num_tests_run + + elapsed_time = float(self.end_time - self.start_time) + + print + print "Ran %d test%s in %.3fs" % (run, + run == 1 and "" or "s", + elapsed_time) + print + + if not self.wasSuccessful(): + + failed, errored = map(len, (self.failures, self.errors)) + + if failed: + failures = "failures=%d" % failed + else: + failures = '' + + if errored: + if failed: + errors = ", errors=%d" % errored + else: + errors = "errors=%d" % errored + else: + errors = '' + + print "FAILED (%s%s)" % (failures, errors) + + else: + print "OK" + return + def startTest(self, test): trace.into('ProctorTestResult', 'startTest', test=test) ! unittest.TestResult.startTest(self, test) ! ! desc = test.shortDescription() or str(test) ! progress_line = '%3d/%3d %s ...' % (self.num_tests_run, ! self.num_tests, ! desc, ! ) ! print progress_line, ! ! self.num_tests_run += 1 ! trace.outof() return *************** *** 102,120 **** def stopTest(self, test): trace.into('ProctorTestResult', 'stopTest', test=test) ! # ! # Save the test output ! # ! existing_output = self.outputs.get(test.id(), '') ! self.outputs[test.id()] = (existing_output, self.output_trap.getvalue()) ! # ! # Replace stderr and stdout ! # ! #sys.stderr = self.stderr ! #sys.stdout = self.stdout ! # ! # Close up the unit test ! # ! #unittest.TestResult.stopTest(self, test) ! self.app.showTestEnd(test) trace.outof() return --- 150,156 ---- def stopTest(self, test): trace.into('ProctorTestResult', 'stopTest', test=test) ! ! unittest.TestResult.stopTest(self, test) ! trace.outof() return *************** *** 127,132 **** trace.into('TestResult', 'addError', test=test, err=err) unittest.TestResult.addError(self, test, err) ! self.app.showTestError(test, err) ! self.outputs[test.id()] = self._exc_info_to_string(err) trace.outof() return --- 163,168 ---- trace.into('TestResult', 'addError', test=test, err=err) unittest.TestResult.addError(self, test, err) ! print 'ERROR' ! print self._exc_info_to_string(err) trace.outof() return *************** *** 135,140 **** trace.into('TestResult', 'addFailure', test=test, err=err) unittest.TestResult.addFailure(self, test, err) ! self.app.showTestFailure(test, err) ! self.outputs[test.id()] = self._exc_info_to_string(err) trace.outof() return --- 171,177 ---- trace.into('TestResult', 'addFailure', test=test, err=err) unittest.TestResult.addFailure(self, test, err) ! print 'FAIL' ! print self._exc_info_to_string(err) ! print trace.outof() return *************** *** 142,169 **** def addSuccess(self, test): trace.into('TestResult', 'addSuccess', test=test) unittest.TestResult.addSuccess(self, test) ! self.app.showTestSuccess(test) trace.outof() return ! def getOutput(self, testId): ! try: ! return self.outputs[testId] ! except KeyError: ! return ('', '') class TestRunner: ! def __init__(self, app): ! self.app = app return ! def _makeResult(self): ! return ProctorTestResult(app=self.app) def run(self, test): ! result = self._makeResult() test(result) return result --- 179,317 ---- def addSuccess(self, test): trace.into('TestResult', 'addSuccess', test=test) + unittest.TestResult.addSuccess(self, test) ! print 'ok' ! trace.outof() return ! ! class ProctorParsableTestResult(ProctorTestResult): ! "Test results displayed in parsable fashion." ! ! PREFIX = '__PROCTOR__' ! ! def __init__(self, testSuite, verbosity): ! ProctorTestResult.__init__(self, testSuite, verbosity) ! return ! ! def startRun(self): ! self._outputSeparator('Start run') ! ProctorTestResult.startRun(self) ! return ! ! def endRun(self): ! self._outputSeparator('End run') ! ProctorTestResult.endRun(self) ! return ! ! def _outputSeparator(self, message): ! print '%s %s' % (self.PREFIX, message) ! print ! return ! ! def startTest(self, test): ! self._outputSeparator('Start test') ! ! unittest.TestResult.startTest(self, test) ! ! print test.id() ! ! self.num_tests_run += 1 ! ! trace.outof() ! return ! ! def stopTest(self, test): ! ProctorTestResult.stopTest(self, test) ! self._outputSeparator('End test') ! # ! # Show progress ! # ! self._outputSeparator('Start progress') ! progress_line = '%3d/%3d' % (self.num_tests_run, ! self.num_tests, ! ) ! print progress_line ! self._outputSeparator('End progress') ! ! return ! ! def addSuccess(self, test): ! unittest.TestResult.addSuccess(self, test) ! ! self._outputSeparator('Start results') ! print 'ok' ! self._outputSeparator('End results') ! return ! ! def addError(self, test, err): ! unittest.TestResult.addError(self, test, err) ! print self._exc_info_to_string(err) ! ! self._outputSeparator('Start results') ! print 'ERROR' ! self._outputSeparator('End results') ! return ! ! def addFailure(self, test, err): ! unittest.TestResult.addFailure(self, test, err) ! ! print self._exc_info_to_string(err) ! ! self._outputSeparator('Start results') ! print 'FAIL' ! self._outputSeparator('End results') ! return ! ! def showSummary(self): ! self._outputSeparator('Start summary') ! elapsed_time = float(self.end_time - self.start_time) ! ! num_failures = len(self.failures) ! num_errors = len(self.errors) ! ! print 'Failures: %d' % num_failures ! print 'Errors: %d' % num_errors ! successes = (self.num_tests - (num_failures + num_errors)) ! print 'Successes: %d' % successes ! print 'Tests: %d' % self.num_tests_run ! print 'Elapsed time (sec): %.3f' % elapsed_time ! ! if num_failures or num_errors: ! status = 'FAILED' ! else: ! status = 'OK' ! ! print 'Status: %s' % status ! ! self._outputSeparator('End summary') ! return ! + class TestRunner: ! def __init__(self, ! verbosity=1, ! resultFactory=ProctorTestResult, ! ): ! self.verbosity = verbosity ! self.result_factory = resultFactory return ! def _makeResult(self, test): ! return self.result_factory(test, self.verbosity) def run(self, test): ! result = self._makeResult(test) ! ! result.startRun() ! test(result) + + result.endRun() + result.showSummary() return result |
From: Doug H. <dou...@us...> - 2003-05-04 22:36:24
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv711/proctorlib Added Files: test_background_runner.py Log Message: Tests for new classes to manage proctorbatch execution in the background. --- NEW FILE: test_background_runner.py --- # # $Id: test_background_runner.py,v 1.1 2003/05/04 22:36:20 doughellmann Exp $ # # Copyright 2003 Racemi, Inc. # """Tests for background_runner.py """ # # Import system modules # import unittest # # Import Local modules # from proctorlib.background_runner import BackgroundTestRunner # # Module # class BackgroundTestRunnerCommandTest(unittest.TestCase): def testWithoutRunning(self): btr = BackgroundTestRunner(runTests=0, inputPaths=['foo']) command = btr.getCommand() self.failUnlessEqual( command, 'proctorbatch --parsable --no-coverage --list --no-run foo' ) return def testWithRunning(self): btr = BackgroundTestRunner(inputPaths=['foo']) command = btr.getCommand() self.failUnlessEqual( command, 'proctorbatch --parsable --no-coverage --list foo' ) return def testWithoutRunningMultiplePaths(self): btr = BackgroundTestRunner(runTests=0, inputPaths=['foo', 'bar']) command = btr.getCommand() self.failUnlessEqual( command, 'proctorbatch --parsable --no-coverage --list --no-run foo bar' ) return def testWithRunningMultiplePaths(self): btr = BackgroundTestRunner(inputPaths=['foo', 'bar']) command = btr.getCommand() self.failUnlessEqual( command, 'proctorbatch --parsable --no-coverage --list foo bar' ) return if __name__ == '__main__': unittest.main() |
From: Doug H. <dou...@us...> - 2003-05-04 22:35:44
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv424/proctorlib Added Files: background_runner.py Log Message: New classes to manage proctorbatch execution in the background. --- NEW FILE: background_runner.py --- # # $Id: background_runner.py,v 1.1 2003/05/04 22:35:41 doughellmann Exp $ # # Copyright 2003 Racemi, Inc. # """Background test runner. Spawns off a 'proctorbatch' job to run the tests based on its arguments, and returns a result set with the test results. """ # # Import system modules # try: from cStringIO import StringIO except: from StringIO import StringIO import popen2 import re # # Import Local modules # # # Module # class TestInfo: "Collect information about the test." def __init__(self, name, description): self.name = name self.description = description self.setStatus('NOT RUN') self.output = '' return def setStatus(self, status): "Set the status of the test." self.status = status return def feed(self, line): "Feed text to the test output buffer." self.output = self.output + line return def __str__(self): return '%s - %s\n%s\n' % (self.name, self.status, self.output) class BackgroundTestRunner: """Background test runner. Spawns off a 'proctorbatch' job to run the tests based on its arguments, and returns a result set with the test results. """ def __init__(self, inputPaths=[], progressFunc=None, runTests=1, appName='proctorbatch', appDefaultArgs='--parsable --no-coverage --list', ): """Constructor Parameters runTests=1 -- Boolean controlling whether tests are actually run. If false, a list of tests is made available but they are not executed. """ self.input_paths = inputPaths self.progress_func = progressFunc self.run_tests = runTests self.app_name = appName self.app_default_args = appDefaultArgs self.test_results = {} self.test_names = [] self.mode = 'not_running' return def getCommand(self): "Returns a command string to be used for this runner." if self.run_tests: run_arg = '' else: run_arg = '--no-run' if self.input_paths: input_names = ' '.join(self.input_paths) else: input_names = '' command = '%s %s %s %s' % (self.app_name, self.app_default_args, run_arg, input_names, ) return command def start(self): "Begin the tests running." command = self.getCommand() self.pipe = popen2.Popen4(command) self._results_buffer = StringIO() return TRANSITIONS = [ (re.compile('^__PROCTOR__ Start list'), 'getting_list'), (re.compile('^__PROCTOR__ End list'), 'not_running'), (re.compile('^__PROCTOR__ Start run'), 'running'), (re.compile('^__PROCTOR__ End run'), 'not_running'), (re.compile('^__PROCTOR__ Start test'), 'in_test'), (re.compile('^__PROCTOR__ End test'), 'running'), (re.compile('^__PROCTOR__ Start results'), 'test_results'), (re.compile('^__PROCTOR__ End results'), 'in_test'), (re.compile('^__PROCTOR__ Start progress'), 'progress'), (re.compile('^__PROCTOR__ End progress'), 'running'), ] def isStillRunning(self): "Return true value if the tests are still running, or false if they are done." poll_results = self.pipe.poll() # # Accumulate the entire output buffer # incremental_output = self.pipe.fromchild.readline() self._results_buffer.write(incremental_output) # # Do we need to change modes? # mode_changed = 0 for pattern, new_mode in self.TRANSITIONS: if pattern.match(incremental_output): self.mode = new_mode mode_changed = 1 break # # Deal with this individual line # using the current mode. # if not mode_changed: handler_name = 'lineHandler_%s' % self.mode handler = getattr(self, handler_name) handler(incremental_output) return (poll_results == -1) def lineHandler_not_running(self, line): "No-op" return def lineHandler_progress(self, line): "No-op" line = line.strip() if line: if self.progress_func: parts = line.split('/') if len(parts) == 2: current, total = parts current = int(current) total = int(total) self.progress_func(current, total) return def lineHandler_getting_list(self, line): "Handle one test name in the list." line_parts = line.split(' ') test_name = line_parts[0] self.test_names.append(test_name) description = ' '.join(line_parts[1:]).strip() if description and description[0] == '(': description = description[1:] if description and description[-1] == '>': description = description[:-1] test_info = TestInfo(test_name, description) self.test_results[test_name] = test_info return def lineHandler_running(self, line): "No-op" # # (Re)Set the current test name # self._current_test_name = None line = line.strip() return def lineHandler_in_test(self, line): "Add line to the output buffer for the individual test." if self._current_test_name is None: line = line.strip() if line: # This is the test name. self._current_test_name = line else: # # We know the test, so just add # to its output buffer. # test_info = self.test_results[self._current_test_name] test_info.feed(line) return def lineHandler_test_results(self, line): "Set the result for the test." line = line.strip() if line: test_info = self.test_results[self._current_test_name] test_info.setStatus(line.strip()) return def end(self): "End the tests running." return if __name__ == '__main__': import time def progress_handler(current, total): print 'CURRENT_PROGRESS:', ((current * 1.0 / total) * 100) btr = BackgroundTestRunner(['.'], progressFunc=progress_handler, runTests=1, appName='./proctorbatch', ) btr.start() while btr.isStillRunning(): pass btr.end() for test_name in btr.test_names: print btr.test_results[test_name] |
From: Doug H. <dou...@us...> - 2003-05-04 20:19:02
|
Update of /cvsroot/proctor/Proctor In directory sc8-pr-cvs1:/tmp/cvs-serv13507 Modified Files: .cvsignore Log Message: Ignore the build directory. Index: .cvsignore =================================================================== RCS file: /cvsroot/proctor/Proctor/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .cvsignore 23 Apr 2003 12:06:56 -0000 1.3 --- .cvsignore 4 May 2003 20:18:59 -0000 1.4 *************** *** 4,5 **** --- 4,6 ---- tmp .coverage + build |
From: Doug H. <dou...@us...> - 2003-04-23 12:21:41
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv9228/proctorlib Modified Files: cui.py Log Message: Added class docstring for proctorbatch and fixed formatting of some of the help messages for options. Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** cui.py 29 Jan 2003 23:27:40 -0000 1.17 --- cui.py 23 Apr 2003 12:20:43 -0000 1.18 *************** *** 73,77 **** class proctorbatch(proctorlib.CommandLineApp): ! shortArgumentsDescription = "[<directory name> ...]" --- 73,85 ---- class proctorbatch(proctorlib.CommandLineApp): ! """ ! Proctor is a tool for running unit tests. It enhances the ! existing unittest module to provide the ability to find all tests ! in a set of code, categorize them, and run some or all of them. ! Test output may be generated in a variety of formats to support ! parsing by another tool or simple, nicely formatted, reports for ! human review. ! """ ! shortArgumentsDescription = "[<directory name> ...]" *************** *** 106,111 **** """Run only the tests in the specified category. ! Warning: If there are no tests in a category, an error will ! not be produced. The test suite will appear to be empty. """ self.category = categoryName --- 114,120 ---- """Run only the tests in the specified category. ! Warning: If there are no tests in a category, ! an error will not be produced. The test suite ! will appear to be empty. """ self.category = categoryName *************** *** 113,117 **** def optionHandler_interleaved(self): ! """Interleave error and failure messages with the test list. """ self.interleaved = 1 --- 122,127 ---- def optionHandler_interleaved(self): ! """Interleave error and failure messages ! with the test list. """ self.interleaved = 1 |
From: Doug H. <dou...@us...> - 2003-04-23 12:20:14
|
Update of /cvsroot/proctor/Proctor In directory sc8-pr-cvs1:/tmp/cvs-serv8436 Added Files: setup.py Log Message: Setup file for installing proctor using distutils. --- NEW FILE: setup.py --- #!/usr/bin/env python # # $Id: setup.py,v 1.1 2003/04/23 12:18:54 doughellmann Exp $ # # Time-stamp: <03/04/23 08:14:26 dhellmann> # # Copyright 2001 Doug Hellmann. # # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of Doug # Hellmann not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # """Distutils setup file for Proctor """ __rcs_info__ = { # # Creation Information # 'module_name' : '$RCSfile: setup.py,v $', 'rcs_id' : '$Id: setup.py,v 1.1 2003/04/23 12:18:54 doughellmann Exp $', 'creator' : 'Doug Hellmann <do...@he...>', 'project' : 'Proctor', 'created' : 'Sat, 03-Feb-2001 12:51:26 EST', # # Current Information # 'author' : '$Author: doughellmann $', 'version' : '$Revision: 1.1 $', 'date' : '$Date: 2003/04/23 12:18:54 $', } try: __version__ = __rcs_info__['version'].split(' ')[1] except: __version__ = '0.0' # # Import system modules # from distutils.core import setup import string import sys # # Import Local modules # # # Module # BSD_LICENSE=""" Copyright 2001, 2002 Doug Hellmann. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Doug Hellmann not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ LONG_DESCRIPTION = """ Proctor is a tool for running unit tests. It enhances the standard unittest module to provide the ability to find all tests in a set of code, categorize them, and run some or all of them. Test output may be generated in a variety of formats to support parsing by another tool or simple, nicely formatted, reports for human review. """ def cvsProductVersion(cvsVersionString='$Name: $'): """Function to return the version number of the program. The value is taken from the CVS tag, assuming the tag has the form: rX_Y_Z Where X is the major version number, Y is the minor version number, and Z is the optional sub-minor version number. """ cvs_version_parts=string.split(cvsVersionString) if len(cvs_version_parts) >= 3: app_version = string.strip(cvs_version_parts[1]).replace('_', '.') if app_version and app_version[0] == 'r': app_version = app_version[1:] else: app_version = 'WORKING' return app_version setup ( name = 'Proctor', version = cvsProductVersion(), description = 'Proctor Test Runner', long_description = LONG_DESCRIPTION, author = 'Doug Hellmann', author_email = 'do...@he...', url = 'http://sourceforge.net/projects/proctor', license = BSD_LICENSE, platforms = ('Any',), keywords = ('test', 'testing', 'unittest'), packages = [ 'proctorlib', ], package_dir = { '': '.' }, scripts = ['proctorbatch'], # discriminators = [ 'Operating System :: OS Independent', # 'Environment :: Console (Text Based)', # 'Programming Language :: Python', # 'License :: OSI Approved :: BSD License', # 'Development Status :: 5 - Production/Stable', # 'Intended Audience :: Developers', # 'Topic :: Software Development', # ], ) |
From: Doug H. <dou...@us...> - 2003-04-23 12:07:57
|
Update of /cvsroot/proctor/Proctor In directory sc8-pr-cvs1:/tmp/cvs-serv3336 Modified Files: .cvsignore Log Message: ignore tmp and coverage settings Index: .cvsignore =================================================================== RCS file: /cvsroot/proctor/Proctor/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 19 Jun 2002 20:16:36 -0000 1.2 --- .cvsignore 23 Apr 2003 12:06:56 -0000 1.3 *************** *** 2,3 **** --- 2,5 ---- PackageTarFiles dist + tmp + .coverage |
From: Doug H. <dou...@us...> - 2003-01-29 23:27:43
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv11046/proctorlib Modified Files: cui.py scanner.py Log Message: Provide the ability to list the test categories. Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** cui.py 10 Jan 2003 16:51:29 -0000 1.16 --- cui.py 29 Jan 2003 23:27:40 -0000 1.17 *************** *** 77,80 **** --- 77,81 ---- list_mode = 0 + list_categories_mode = 0 run_mode = 1 parsable_mode = 0 *************** *** 90,93 **** --- 91,100 ---- return + def optionHandler_list_categories(self): + """List test categories. + """ + self.list_categories_mode = 1 + return + def optionHandler_norun(self): """Do not run the tests *************** *** 284,288 **** if self.parsable_mode: print '*** Start list' ! suite = moduleTree.getTestSuite(1) for test in suite._tests: self._showTestInfo(test, None) --- 291,295 ---- if self.parsable_mode: print '*** Start list' ! suite = moduleTree.getTestSuite(1, category=self.category) for test in suite._tests: self._showTestInfo(test, None) *************** *** 292,295 **** --- 299,309 ---- return success + def listCategories(self, moduleTree): + categories = moduleTree.getTestCategories() + categories.sort() + for category in categories: + print category + return + def getModuleTree(self, args): *************** *** 322,325 **** --- 336,343 ---- module_tree = self.getModuleTree(args) success = self.listTests(module_tree) + + elif self.list_categories_mode: + module_tree = self.getModuleTree(args) + success = self.listCategories(module_tree) elif self.run_mode: Index: scanner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/scanner.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** scanner.py 10 Jan 2003 16:52:22 -0000 1.19 --- scanner.py 29 Jan 2003 23:27:40 -0000 1.20 *************** *** 248,251 **** --- 248,271 ---- return test_suite + def getTestCategories(self, categoryList=None): + if categoryList is None: + categoryList = [] + # + # Categories at this level + # + my_categories = self.test_suites.keys() + for my_category in my_categories: + if my_category not in categoryList: + categoryList.append(my_category) + + # + # Recurse + # + children = self.data.items() + for child_name, child_node in children: + child_node.getTestCategories(categoryList) + + return categoryList + def getTestSuite(self, full=0, category='All'): trace.into('ModuleTree', 'getTestSuite', outputLevel=self.TRACE_LEVEL) |
From: Doug H. <dou...@us...> - 2003-01-10 16:52:51
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv11553/proctorlib Modified Files: tests.py Log Message: New test to verify that modules are only imported once. Index: tests.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/tests.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tests.py 3 Dec 2002 14:19:59 -0000 1.9 --- tests.py 10 Jan 2003 16:52:44 -0000 1.10 *************** *** 62,69 **** --- 62,81 ---- # Import Local modules # + from proctorlib import importcount # # Module # + + importcount._import_count += 1 + + class TestImportCount(unittest.TestCase): + + def testImportedOnlyOnce(self): + from proctorlib import importcount + self.failUnlessEqual(importcount._import_count, + 1, + ) + return class ExampleTestCase(unittest.TestCase): |
From: Doug H. <dou...@us...> - 2003-01-10 16:52:28
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv11383/proctorlib Modified Files: scanner.py Log Message: If we can find a module in our cache, do not re-import it. Index: scanner.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/scanner.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** scanner.py 4 Dec 2002 12:14:42 -0000 1.18 --- scanner.py 10 Jan 2003 16:52:22 -0000 1.19 *************** *** 70,73 **** --- 70,75 ---- # + _module_cache = {} + class ModuleTree: *************** *** 98,119 **** outputLevel=self.TRACE_LEVEL) ! fp, pathname, description = imp.find_module(module_base, [directory]) ! ! trace.writeVar(module_base=module_base, ! fp=fp, ! pathname=pathname, ! description=description, ! outputLevel=self.TRACE_LEVEL) ! try: ! load_module_args = (module_base, fp, pathname, description) ! trace.write('load_module%s' % str(load_module_args), outputLevel=self.TRACE_LEVEL) try: ! module = apply(imp.load_module, load_module_args) ! except Exception, msg: ! raise ImportError(str(msg)) ! finally: ! if fp: ! fp.close() except ImportError, msg: --- 100,135 ---- outputLevel=self.TRACE_LEVEL) ! module = None ! global _module_cache try: ! module = _module_cache[(module_base, directory)] ! trace.write('Found module %s.%s in cache' % (directory, ! module_base, ! ) ! ) ! except KeyError: ! fp, pathname, description = imp.find_module(module_base, ! [directory]) ! ! trace.writeVar(module_base=module_base, ! fp=fp, ! pathname=pathname, ! description=description, ! outputLevel=self.TRACE_LEVEL) ! ! ! try: ! load_module_args = (module_base, fp, pathname, description) ! trace.write('load_module%s' % str(load_module_args), outputLevel=self.TRACE_LEVEL) ! try: ! module = apply(imp.load_module, load_module_args) ! except Exception, msg: ! raise ImportError(str(msg)) ! ! _module_cache[(module_base, directory)] = module ! finally: ! if fp: ! fp.close() except ImportError, msg: |
From: Doug H. <dou...@us...> - 2003-01-10 16:52:01
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv11200/proctorlib Added Files: importcount.py Log Message: New module for testing import code. --- NEW FILE: importcount.py --- #!/usr/bin/env python # # $Id: importcount.py,v 1.1 2003/01/10 16:51:55 doughellmann Exp $ # # Copyright 2002 Doug Hellmann. # # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of Doug # Hellmann not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # """Test module for Proctor """ __rcs_info__ = { # # Creation Information # 'module_name' : '$RCSfile: importcount.py,v $', 'rcs_id' : '$Id: importcount.py,v 1.1 2003/01/10 16:51:55 doughellmann Exp $', 'creator' : 'Doug Hellmann <do...@he...>', 'project' : 'Proctor', 'created' : 'Fri, 10-Jan-2003 11:47:22 EST', # # Current Information # 'author' : '$Author: doughellmann $', 'version' : '$Revision: 1.1 $', 'date' : '$Date: 2003/01/10 16:51:55 $', } try: __version__ = __rcs_info__['version'].split(' ')[1] except: __version__ = '0.0' # # Import system modules # # # Import Local modules # # # Module # _import_count = 0 |
From: Doug H. <dou...@us...> - 2003-01-10 16:51:34
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv11043/proctorlib Modified Files: cui.py Log Message: Beautify the output a bit. Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** cui.py 5 Dec 2002 17:16:36 -0000 1.15 --- cui.py 10 Jan 2003 16:51:29 -0000 1.16 *************** *** 174,177 **** --- 174,178 ---- print 'FAIL' print self._exc_info_to_string(err) + print trace.outof() return |
From: Doug H. <dou...@us...> - 2002-12-05 17:16:39
|
Update of /cvsroot/proctor/Proctor/proctorlib In directory sc8-pr-cvs1:/tmp/cvs-serv8216 Modified Files: cui.py Log Message: Include a counter with each test name to indicate how far into the set we are as the tests go by. Index: cui.py =================================================================== RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** cui.py 4 Dec 2002 13:15:00 -0000 1.14 --- cui.py 5 Dec 2002 17:16:36 -0000 1.15 *************** *** 145,149 **** print print '*** begin test' ! print desc, '...', trace.outof() return --- 145,157 ---- print print '*** begin test' ! ! self.num_tests_run += 1 ! ! progress_line = '%3d/%3d %s ...' % (self.num_tests_run, ! self.num_tests, ! desc, ! ) ! ! print progress_line, trace.outof() return *************** *** 196,200 **** test_runner = unittest.TextTestRunner(descriptions=0, verbosity=verbosity) ! result = test_runner.run(test_suite) --- 204,214 ---- test_runner = unittest.TextTestRunner(descriptions=0, verbosity=verbosity) ! ! # ! # Set up progress management info. ! # ! self.num_tests = test_suite.countTestCases() ! self.num_tests_run = 0 ! result = test_runner.run(test_suite) *************** *** 225,228 **** --- 239,244 ---- if failed: failures = "failures=%d" % failed + else: + failures = '' if errored: *************** *** 231,234 **** --- 247,252 ---- else: errors = "errors=%d" % errored + else: + errors = '' print "FAILED (%s%s)" % (failures, errors) |