Ticket #4460: runtests-granularity.patch
| File runtests-granularity.patch, 2.1 kB (added by Brian Harring <ferringb@gmail.com>, 1 year ago) |
|---|
-
tests/runtests.py
old new 103 103 104 104 # Load all the test model apps. 105 105 test_models = [] 106 if not tests_to_run or '.*' in tests_to_run: 107 desired_test = lambda x:True 108 else: 109 tests_filter = tests_to_run[:] 110 for idx, x in enumerate(tests_filter): 111 if x.endswith(".*"): 112 x = x.rstrip(".*") 113 tests_filter[idx] = x + "." 114 def desired_test(name): 115 name += '.' 116 if name in tests_filter: 117 return True 118 return bool([x for x in tests_filter if name.startswith(x)]) 119 106 120 for model_dir, model_name in get_test_models(): 107 121 model_label = '.'.join([model_dir, model_name]) 108 122 try: 109 123 # if the model was named on the command line, or 110 124 # no models were named (i.e., run all), import 111 125 # this model and add it to the list to test. 112 if not tests_to_run or model_name in tests_to_run:126 if desired_test(model_label): 113 127 if verbosity >= 1: 114 128 print "Importing model %s" % model_name 115 129 mod = load_app(model_label) … … 125 139 extra_tests = [] 126 140 for model_dir, model_name in get_invalid_models(): 127 141 model_label = '.'.join([model_dir, model_name]) 128 if not tests_to_run or model_name in tests_to_run:142 if desired_test(model_label): 129 143 extra_tests.append(InvalidModelTestCase(model_label)) 130 144 131 145 # Run the test suite, including the extra validation tests. … … 144 158 145 159 if __name__ == "__main__": 146 160 from optparse import OptionParser 147 usage = "%prog [options] [ model model model ...]"161 usage = "%prog [options] [ [ modeltests.model1 modeltests.model2 ...] || modeltests.* ] [ [ regressiontests.regression1 regresiontests.regresion2 ...] || regresiontests.* ]" 148 162 parser = OptionParser(usage=usage) 149 163 parser.add_option('-v','--verbosity', action='store', dest='verbosity', default='0', 150 164 type='choice', choices=['0', '1', '2'],
