def createTesters(self, dirpath, file, find_only, testroot_params={}): # Build a Parser to parse the objects parser = Parser(self.factory, self.warehouse) # Parse it parser.parse(file, testroot_params.get("root_params", self.root_params)) self.parse_errors.extend(parser.errors) # Retrieve the tests from the warehouse testers = self.warehouse.getActiveObjects() # Augment the Testers with additional information directly from the TestHarness for tester in testers: # Initialize the status system for each tester object immediately after creation tester.initStatusSystem(self.options) self.augmentParameters(file, tester, testroot_params) if testroot_params.get("caveats"): # Show what executable we are using if using a different testroot file tester.addCaveats(testroot_params["caveats"]) # Short circuit this loop if we've only been asked to parse Testers # Note: The warehouse will accumulate all testers in this mode if find_only: self.warehouse.markAllObjectsInactive() return [] # Clear out the testers, we won't need them to stick around in the warehouse self.warehouse.clear() if self.options.enable_recover: testers = self.appendRecoverableTests(testers) return testers
def createTesters(self, dirpath, file, find_only, testroot_params={}): # Build a Parser to parse the objects parser = Parser(self.factory, self.warehouse) # Parse it parser.parse(file, testroot_params.get("root_params", self.root_params)) self.parse_errors.extend(parser.errors) # Retrieve the tests from the warehouse testers = self.warehouse.getActiveObjects() # Augment the Testers with additional information directly from the TestHarness for tester in testers: # Initialize the status system for each tester object immediately after creation tester.initStatusSystem(self.options) self.augmentParameters(file, tester, testroot_params) if testroot_params.get("caveats"): # Show what executable we are using if using a different testroot file tester.addCaveats(testroot_params["caveats"]) # Short circuit this loop if we've only been asked to parse Testers # Note: The warehouse will accumulate all testers in this mode if find_only: self.warehouse.markAllObjectsInactive() return [] # Clear out the testers, we won't need them to stick around in the warehouse self.warehouse.clear() if self.options.enable_recover: testers = self.appendRecoverableTests(testers) return testers
def createTesters(self, dirpath, file, find_only): # Build a Parser to parse the objects parser = Parser(self.factory, self.warehouse) # Parse it self.error_code = self.error_code | parser.parse(file) # Retrieve the tests from the warehouse testers = self.warehouse.getActiveObjects() # Augment the Testers with additional information directly from the TestHarness for tester in testers: self.augmentParameters(file, tester) # Short circuit this loop if we've only been asked to parse Testers # Note: The warehouse will accumulate all testers in this mode if find_only: self.warehouse.markAllObjectsInactive() return [] # Clear out the testers, we won't need them to stick around in the warehouse self.warehouse.clear() if self.options.enable_recover: testers = self.appendRecoverableTests(testers) return testers
def createTesters(self, dirpath, file, find_only): # Build a Parser to parse the objects parser = Parser(self.factory, self.warehouse) # Parse it self.error_code = self.error_code | parser.parse(file) # Retrieve the tests from the warehouse testers = self.warehouse.getActiveObjects() # Augment the Testers with additional information directly from the TestHarness for tester in testers: self.augmentParameters(file, tester) # Short circuit this loop if we've only been asked to parse Testers # Note: The warehouse will accumulate all testers in this mode if find_only: self.warehouse.markAllObjectsInactive() return [] # Clear out the testers, we won't need them to stick around in the warehouse self.warehouse.clear() if self.options.enable_recover: testers = self.appendRecoverableTests(testers) return testers
def cleanup(self): # Print the results table again if a bunch of output was spewed to the screen between # tests as they were running if (self.options.verbose or (self.num_failed != 0 and not self.options.quiet)) and not self.options.dry_run: print('\n\nFinal Test Results:\n' + ('-' * (util.TERM_COLS-1))) for (tester_data, result, timing) in sorted(self.test_table, key=lambda x: x[1], reverse=True): print(util.formatResult(tester_data, result, self.options)) time = clock() - self.start_time print('-' * (util.TERM_COLS-1)) # Mask off TestHarness error codes to report parser errors fatal_error = '' if self.error_code & Parser.getErrorCodeMask(): fatal_error += ', <r>FATAL PARSER ERROR</r>' if self.error_code & ~Parser.getErrorCodeMask(): fatal_error += ', <r>FATAL TEST HARNESS ERROR</r>' # Alert the user to their session file if self.options.queueing: print 'Your session file is %s' % self.options.session_file # Print a different footer when performing a dry run if self.options.dry_run: print('Processed %d tests in %.1f seconds' % (self.num_passed+self.num_skipped, time)) summary = '<b>%d would run</b>' summary += ', <b>%d would be skipped</b>' summary += fatal_error print(util.colorText( summary % (self.num_passed, self.num_skipped), "", html = True, \ colored=self.options.colored, code=self.options.code )) else: print('Ran %d tests in %.1f seconds' % (self.num_passed+self.num_failed, time)) if self.num_passed: summary = '<g>%d passed</g>' else: summary = '<b>%d passed</b>' summary += ', <b>%d skipped</b>' if self.num_pending: summary += ', <c>%d pending</c>' else: summary += ', <b>%d pending</b>' if self.num_failed: summary += ', <r>%d FAILED</r>' else: summary += ', <b>%d failed</b>' summary += fatal_error print(util.colorText( summary % (self.num_passed, self.num_skipped, self.num_pending, self.num_failed), "", html = True, \ colored=self.options.colored, code=self.options.code )) if self.file: self.file.close() # Close the failed_tests file if self.writeFailedTest != None: self.writeFailedTest.close()
def cleanup(self): # Print the results table again if a bunch of output was spewed to the screen between # tests as they were running if (self.options.verbose or (self.num_failed != 0 and not self.options.quiet)) and not self.options.dry_run: print('\n\nFinal Test Results:\n' + ('-' * (util.TERM_COLS - 1))) for (tester_data, result, timing) in sorted(self.test_table, key=lambda x: x[1], reverse=True): print(util.formatResult(tester_data, result, self.options)) time = clock() - self.start_time print('-' * (util.TERM_COLS - 1)) # Mask off TestHarness error codes to report parser errors fatal_error = '' if self.error_code & Parser.getErrorCodeMask(): fatal_error += ', <r>FATAL PARSER ERROR</r>' if self.error_code & ~Parser.getErrorCodeMask(): fatal_error += ', <r>FATAL TEST HARNESS ERROR</r>' # Alert the user to their session file if self.queueing: print 'Your session file is %s' % self.options.session_file # Print a different footer when performing a dry run if self.options.dry_run: print('Processed %d tests in %.1f seconds' % (self.num_passed + self.num_skipped, time)) summary = '<b>%d would run</b>' summary += ', <b>%d would be skipped</b>' summary += fatal_error print(util.colorText( summary % (self.num_passed, self.num_skipped), "", html = True, \ colored=self.options.colored, code=self.options.code )) else: print('Ran %d tests in %.1f seconds' % (self.num_passed + self.num_failed, time)) if self.num_passed: summary = '<g>%d passed</g>' else: summary = '<b>%d passed</b>' summary += ', <b>%d skipped</b>' if self.num_pending: summary += ', <c>%d pending</c>' else: summary += ', <b>%d pending</b>' if self.num_failed: summary += ', <r>%d FAILED</r>' else: summary += ', <b>%d failed</b>' summary += fatal_error print(util.colorText( summary % (self.num_passed, self.num_skipped, self.num_pending, self.num_failed), "", html = True, \ colored=self.options.colored, code=self.options.code )) if self.file: self.file.close() # Close the failed_tests file if self.writeFailedTest != None: self.writeFailedTest.close()