|  | @@ -12,9 +12,9 @@ import time
 | 
	
		
			
			| 12 | 12 |  from copy import deepcopy
 | 
	
		
			
			| 13 | 13 |  
 | 
	
		
			
			| 14 | 14 |  
 | 
	
		
			
			| 15 |  | -###############################################################################
 | 
	
		
			
			| 16 |  | -## The Motor                                                                 ##
 | 
	
		
			
			| 17 |  | -###############################################################################
 | 
	
		
			
			|  | 15 | +# ########################################################################### #
 | 
	
		
			
			|  | 16 | +# ## The Motor                                                             ## #
 | 
	
		
			
			|  | 17 | +# ########################################################################### #
 | 
	
		
			
			| 18 | 18 |  
 | 
	
		
			
			| 19 | 19 |  def regression_test(argsrc, tests, driver_settings, cleanup_hack=None,
 | 
	
		
			
			| 20 | 20 |                      apply_hacks=None, on_next=None):
 | 
	
	
		
			
			|  | @@ -69,7 +69,7 @@ def regression_test(argsrc, tests, driver_settings, cleanup_hack=None,
 | 
	
		
			
			| 69 | 69 |          on_next(argset, last_argset)
 | 
	
		
			
			| 70 | 70 |          counter.add('on_next', time.time() - on_start)
 | 
	
		
			
			| 71 | 71 |  
 | 
	
		
			
			| 72 |  | -        ## load the data first, only once for each driver
 | 
	
		
			
			|  | 72 | +        # # load the data first, only once for each driver
 | 
	
		
			
			| 73 | 73 |          #
 | 
	
		
			
			| 74 | 74 |          data = {}
 | 
	
		
			
			| 75 | 75 |          for aclass in all_classes:
 | 
	
	
		
			
			|  | @@ -151,9 +151,9 @@ def get_data(driverClass, argset, driver_settings):
 | 
	
		
			
			| 151 | 151 |      return d.data
 | 
	
		
			
			| 152 | 152 |  
 | 
	
		
			
			| 153 | 153 |  
 | 
	
		
			
			| 154 |  | -###############################################################################
 | 
	
		
			
			| 155 |  | -## The Pattern                                                               ##
 | 
	
		
			
			| 156 |  | -###############################################################################
 | 
	
		
			
			|  | 154 | +# ########################################################################### #
 | 
	
		
			
			|  | 155 | +# ## The Pattern                                                           ## #
 | 
	
		
			
			|  | 156 | +# ########################################################################### #
 | 
	
		
			
			| 157 | 157 |  
 | 
	
		
			
			| 158 | 158 |  class _BaseRuleOp():
 | 
	
		
			
			| 159 | 159 |  
 | 
	
	
		
			
			|  | @@ -213,9 +213,9 @@ class RuleOp():
 | 
	
		
			
			| 213 | 213 |          return bool(op(items, item_ok))
 | 
	
		
			
			| 214 | 214 |  
 | 
	
		
			
			| 215 | 215 |  
 | 
	
		
			
			| 216 |  | -###############################################################################
 | 
	
		
			
			| 217 |  | -## The Path                                                                  ##
 | 
	
		
			
			| 218 |  | -###############################################################################
 | 
	
		
			
			|  | 216 | +# ########################################################################### #
 | 
	
		
			
			|  | 217 | +# ## The Path                                                              ## #
 | 
	
		
			
			|  | 218 | +# ########################################################################### #
 | 
	
		
			
			| 219 | 219 |  
 | 
	
		
			
			| 220 | 220 |  class DictPath():
 | 
	
		
			
			| 221 | 221 |      """Mixin that adds "path-like" behavior to the top dict of dicts.
 | 
	
	
		
			
			|  | @@ -275,7 +275,7 @@ class DictPath():
 | 
	
		
			
			| 275 | 275 |              subdct = dct[frag]
 | 
	
		
			
			| 276 | 276 |              return cls.__delitem(subdct, rest)
 | 
	
		
			
			| 277 | 277 |  
 | 
	
		
			
			| 278 |  | -    ## public methods
 | 
	
		
			
			|  | 278 | +    # # public methods
 | 
	
		
			
			| 279 | 279 |      #
 | 
	
		
			
			| 280 | 280 |  
 | 
	
		
			
			| 281 | 281 |      def getpath(self, path):
 | 
	
	
		
			
			|  | @@ -304,9 +304,9 @@ class DictPath():
 | 
	
		
			
			| 304 | 304 |              return False
 | 
	
		
			
			| 305 | 305 |  
 | 
	
		
			
			| 306 | 306 |  
 | 
	
		
			
			| 307 |  | -###############################################################################
 | 
	
		
			
			| 308 |  | -## The Case                                                                  ##
 | 
	
		
			
			| 309 |  | -###############################################################################
 | 
	
		
			
			|  | 307 | +# ########################################################################### #
 | 
	
		
			
			|  | 308 | +# ## The Case                                                              ## #
 | 
	
		
			
			|  | 309 | +# ########################################################################### #
 | 
	
		
			
			| 310 | 310 |  
 | 
	
		
			
			| 311 | 311 |  class TinyCase(dict, DictPath):
 | 
	
		
			
			| 312 | 312 |      """Abstraction of the smallest unit of testing.
 | 
	
	
		
			
			|  | @@ -480,9 +480,9 @@ class TinyCase(dict, DictPath):
 | 
	
		
			
			| 480 | 480 |          return matched
 | 
	
		
			
			| 481 | 481 |  
 | 
	
		
			
			| 482 | 482 |  
 | 
	
		
			
			| 483 |  | -###############################################################################
 | 
	
		
			
			| 484 |  | -## Drivers                                                                   ##
 | 
	
		
			
			| 485 |  | -###############################################################################
 | 
	
		
			
			|  | 483 | +# ########################################################################### #
 | 
	
		
			
			|  | 484 | +# ## Drivers                                                               ## #
 | 
	
		
			
			|  | 485 | +# ########################################################################### #
 | 
	
		
			
			| 486 | 486 |  
 | 
	
		
			
			| 487 | 487 |  class DriverError(Exception):
 | 
	
		
			
			| 488 | 488 |      """Error encountered when obtaining driver data"""
 | 
	
	
		
			
			|  | @@ -705,9 +705,9 @@ class MockDriverTrue(BaseTestDriver):
 | 
	
		
			
			| 705 | 705 |          self.data = True
 | 
	
		
			
			| 706 | 706 |  
 | 
	
		
			
			| 707 | 707 |  
 | 
	
		
			
			| 708 |  | -###############################################################################
 | 
	
		
			
			| 709 |  | -## Helpers                                                                   ##
 | 
	
		
			
			| 710 |  | -###############################################################################
 | 
	
		
			
			|  | 708 | +# ########################################################################### #
 | 
	
		
			
			|  | 709 | +# ## Helpers                                                               ## #
 | 
	
		
			
			|  | 710 | +# ########################################################################### #
 | 
	
		
			
			| 711 | 711 |  
 | 
	
		
			
			| 712 | 712 |  class StatCounter(object):
 | 
	
		
			
			| 713 | 713 |      """A simple counter with formulas support."""
 | 
	
	
		
			
			|  | @@ -728,18 +728,16 @@ class StatCounter(object):
 | 
	
		
			
			| 728 | 728 |          }
 | 
	
		
			
			| 729 | 729 |  
 | 
	
		
			
			| 730 | 730 |          ##
 | 
	
		
			
			| 731 |  | -        ## Formulas.  A lot of them.
 | 
	
		
			
			| 732 |  | -        ##
 | 
	
		
			
			| 733 |  | -
 | 
	
		
			
			| 734 |  | -        ## cumulative duration/overhead; just round to ms
 | 
	
		
			
			|  | 731 | +        # Formulas
 | 
	
		
			
			| 735 | 732 |          #
 | 
	
		
			
			|  | 733 | +
 | 
	
		
			
			|  | 734 | +        # cumulative duration/overhead; just round to ms
 | 
	
		
			
			| 736 | 735 |          self.add_formula(dname + '_overhead',
 | 
	
		
			
			| 737 | 736 |                           lambda g, d: int(1000 * d[dname]['overhead']))
 | 
	
		
			
			| 738 | 737 |          self.add_formula(dname + '_duration',
 | 
	
		
			
			| 739 | 738 |                           lambda g, d: int(1000 * d[dname]['duration']))
 | 
	
		
			
			| 740 | 739 |  
 | 
	
		
			
			| 741 |  | -        ## average (per driver call) overhead/duration
 | 
	
		
			
			| 742 |  | -        #
 | 
	
		
			
			|  | 740 | +        # average (per driver call) overhead/duration
 | 
	
		
			
			| 743 | 741 |          self.add_formula(
 | 
	
		
			
			| 744 | 742 |              dname + '_overhead_per_call',
 | 
	
		
			
			| 745 | 743 |              lambda g, d: int(1000 * d[dname]['overhead'] / d[dname]['calls'])
 | 
	
	
		
			
			|  | @@ -749,8 +747,6 @@ class StatCounter(object):
 | 
	
		
			
			| 749 | 747 |              lambda g, d: int(1000 * d[dname]['duration'] / d[dname]['calls'])
 | 
	
		
			
			| 750 | 748 |          )
 | 
	
		
			
			| 751 | 749 |  
 | 
	
		
			
			| 752 |  | -        ## grand totals in times: driver time, loop overhead
 | 
	
		
			
			| 753 |  | -        #
 | 
	
		
			
			| 754 | 750 |          def gtotal_drivertime(g, d):
 | 
	
		
			
			| 755 | 751 |              driver_time = (sum(s['overhead'] for s in d.values())
 | 
	
		
			
			| 756 | 752 |                             + sum(s['duration'] for s in d.values()))
 | 
	
	
		
			
			|  | @@ -762,13 +758,13 @@ class StatCounter(object):
 | 
	
		
			
			| 762 | 758 |              age = int(1000 * (time.time() - self._born))
 | 
	
		
			
			| 763 | 759 |              return age - driver_time - onnext_time
 | 
	
		
			
			| 764 | 760 |  
 | 
	
		
			
			|  | 761 | +        # grand totals in times: driver time, loop overhead
 | 
	
		
			
			| 765 | 762 |          self.add_formula('gtotal_drivertime', gtotal_drivertime)
 | 
	
		
			
			| 766 | 763 |          self.add_formula('gtotal_loop_overhead', gtotal_loop_overhead)
 | 
	
		
			
			| 767 | 764 |          self.add_formula('gtotal_loop_onnext',
 | 
	
		
			
			| 768 | 765 |                           lambda g, d: int(1000 * g['on_next']))
 | 
	
		
			
			| 769 | 766 |  
 | 
	
		
			
			| 770 |  | -        ## average (per driver call) overhead/duration
 | 
	
		
			
			| 771 |  | -        #
 | 
	
		
			
			|  | 767 | +        # average (per driver call) overhead/duration
 | 
	
		
			
			| 772 | 768 |          self.add_formula(
 | 
	
		
			
			| 773 | 769 |              'cases_hacked',
 | 
	
		
			
			| 774 | 770 |              lambda g, d: round(100 * float(g['hacked_cases']) / g['cases'], 2)
 | 
	
	
		
			
			|  | @@ -884,7 +880,7 @@ class Tracker(dict):
 | 
	
		
			
			| 884 | 880 |  
 | 
	
		
			
			| 885 | 881 |      def _insert(self, errstr, argset):
 | 
	
		
			
			| 886 | 882 |          """Insert the argset into DB."""
 | 
	
		
			
			| 887 |  | -        if not errstr in self._db:
 | 
	
		
			
			|  | 883 | +        if errstr not in self._db:
 | 
	
		
			
			| 888 | 884 |              self._db[errstr] = []
 | 
	
		
			
			| 889 | 885 |          self._db[errstr].append(argset)
 | 
	
		
			
			| 890 | 886 |  
 | 
	
	
		
			
			|  | @@ -997,11 +993,6 @@ class Tracker(dict):
 | 
	
		
			
			| 997 | 993 |                      cw.writerow(argset)
 | 
	
		
			
			| 998 | 994 |  
 | 
	
		
			
			| 999 | 995 |  
 | 
	
		
			
			| 1000 |  | -## ............................................................................
 | 
	
		
			
			| 1001 |  | -## dataMatch -- a data structure matcher
 | 
	
		
			
			| 1002 |  | -##
 | 
	
		
			
			| 1003 |  | -#
 | 
	
		
			
			| 1004 |  | -
 | 
	
		
			
			| 1005 | 996 |  def dataMatch(pattern, data, rmax=10, _r=0):
 | 
	
		
			
			| 1006 | 997 |      """Check if data structure matches a pattern data structure.
 | 
	
		
			
			| 1007 | 998 |  
 | 
	
	
		
			
			|  | @@ -1216,11 +1207,6 @@ def jsDiff(dira, dirb, namea="A", nameb="B", chara="a", charb="b"):
 | 
	
		
			
			| 1216 | 1207 |      return "\n".join(compress([line for line in udiff]))
 | 
	
		
			
			| 1217 | 1208 |  
 | 
	
		
			
			| 1218 | 1209 |  
 | 
	
		
			
			| 1219 |  | -#
 | 
	
		
			
			| 1220 |  | -## Cartman - create dict arguments from dicts of available values (iterables)
 | 
	
		
			
			| 1221 |  | -#            and a defined scheme
 | 
	
		
			
			| 1222 |  | -#
 | 
	
		
			
			| 1223 |  | -
 | 
	
		
			
			| 1224 | 1210 |  class Cartman(object):
 | 
	
		
			
			| 1225 | 1211 |      """Create argument sets from ranges (or ay iterators) of values.
 | 
	
		
			
			| 1226 | 1212 |  
 |