Changeset 1b50776 in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Mar 9, 2015 4:22:34 PM (9 years ago)
Author:
Doucet, Mathieu <doucetm@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c71da73
Parents:
ddfe69c
Message:

Adding better test names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    rddfe69c r1b50776  
    115115            if not ispy and ('opencl' in loaders and load_model_cl): 
    116116                test_name = "Model: %s, Kernel: OpenCL"%model_name 
     117                test_method = "test_%s_opencl" % model_name 
    117118                test = ModelTestCase(test_name, model_definition, 
    118                                      load_model_cl, tests) 
     119                                     load_model_cl, tests, test_method) 
    119120                #print "defining", test_name 
    120121                suite.addTest(test) 
     
    123124            if ispy or ('dll' in loaders and load_model_dll): 
    124125                test_name = "Model: %s, Kernel: dll"%model_name 
     126                test_method = "test_%s_dll" % model_name 
    125127                test = ModelTestCase(test_name, model_definition, 
    126                                      load_model_dll, tests) 
    127                 #print "defining", test_name 
     128                                     load_model_dll, tests, test_method) 
    128129                suite.addTest(test) 
    129130 
     
    132133def _hide_model_case_from_nosetests(): 
    133134    class ModelTestCase(unittest.TestCase): 
    134         def __init__(self, test_name, definition, loader, tests): 
    135             unittest.TestCase.__init__(self) 
    136  
     135        def __init__(self, test_name, definition, loader, tests, test_method): 
    137136            self.test_name = test_name 
    138137            self.definition = definition 
     
    140139            self.tests = tests 
    141140 
    142         def runTest(self): 
     141            setattr(self, test_method, self._runTest) 
     142            unittest.TestCase.__init__(self, test_method) 
     143 
     144        def _runTest(self): 
    143145            try: 
    144146                model = self.loader(self.definition) 
     
    191193 
    192194 
    193 # let nosetests sniff out the tests 
    194 def model_tests(): 
    195     tests = make_suite(['opencl','dll'],['all']) 
    196     for test_i in tests: 
    197         yield test_i.runTest 
    198195 
    199196def main(): 
Note: See TracChangeset for help on using the changeset viewer.