Changeset 17bbadd in sasmodels for sasmodels/model_test.py
- Timestamp:
- Mar 15, 2016 10:47:12 AM (8 years ago)
- 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:
- 754e27b
- Parents:
- 5ceb7d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r13ed84c r17bbadd 50 50 import numpy as np 51 51 52 from .core import list_models, load_model_ definition, load_model, HAVE_OPENCL52 from .core import list_models, load_model_info, build_model, HAVE_OPENCL 53 53 from .core import make_kernel, call_kernel, call_ER, call_VR 54 54 from .exception import annotate_exception 55 55 56 #TODO: rename to tests so that tab completion works better for models directory 56 57 57 58 def make_suite(loaders, models): … … 76 77 for model_name in models: 77 78 if model_name in skip: continue 78 model_ definition = load_model_definition(model_name)79 model_info = load_model_info(model_name) 79 80 80 81 #print('------') … … 85 86 # don't try to call cl kernel since it will not be 86 87 # available in some environmentes. 87 is_py = callable( getattr(model_definition, 'Iq', None))88 is_py = callable(model_info['Iq']) 88 89 89 90 if is_py: # kernel implemented in python 90 91 test_name = "Model: %s, Kernel: python"%model_name 91 92 test_method_name = "test_%s_python" % model_name 92 test = ModelTestCase(test_name, model_ definition,93 test = ModelTestCase(test_name, model_info, 93 94 test_method_name, 94 95 platform="dll", # so that … … 104 105 # single precision. The choice is determined by the 105 106 # presence of *single=False* in the model file. 106 test = ModelTestCase(test_name, model_ definition,107 test = ModelTestCase(test_name, model_info, 107 108 test_method_name, 108 109 platform="ocl", dtype=None) … … 114 115 test_name = "Model: %s, Kernel: dll"%model_name 115 116 test_method_name = "test_%s_dll" % model_name 116 test = ModelTestCase(test_name, model_ definition,117 test = ModelTestCase(test_name, model_info, 117 118 test_method_name, 118 119 platform="dll", … … 132 133 description file. 133 134 """ 134 def __init__(self, test_name, definition, test_method_name,135 def __init__(self, test_name, model_info, test_method_name, 135 136 platform, dtype): 136 137 self.test_name = test_name 137 self. definition = definition138 self.info = model_info 138 139 self.platform = platform 139 140 self.dtype = dtype … … 150 151 ] 151 152 152 tests = getattr(self.definition, 'tests', [])153 tests = self.info['tests'] 153 154 try: 154 model = load_model(self.definition, dtype=self.dtype,155 platform=self.platform)155 model = build_model(self.info, dtype=self.dtype, 156 platform=self.platform) 156 157 for test in smoke_tests + tests: 157 158 self._run_one_test(model, test)
Note: See TracChangeset
for help on using the changeset viewer.