Changeset 1a6cd57 in sasmodels for sasmodels/model_test.py
- Timestamp:
- Oct 11, 2016 11:25:56 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 2ccb775, 997d4eb
- Parents:
- c1904f6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r897ca7f r1a6cd57 121 121 122 122 # test using dll if desired 123 if 'dll' in loaders :123 if 'dll' in loaders or not core.HAVE_OPENCL: 124 124 test_name = "Model: %s, Kernel: dll"%model_name 125 125 test_method_name = "test_%s_dll" % model_info.id … … 270 270 271 271 # Build a test suite containing just the model 272 loaders = ['opencl'] 272 loaders = ['opencl'] if core.HAVE_OPENCL else ['dll'] 273 273 models = [model] 274 274 try: … … 288 288 stream.writeln(tb) 289 289 290 # Check if there are user defined tests. 291 # Yes, it is naughty to peek into the structure of the test suite, and 292 # to assume that it contains only one test. 293 if not suite._tests[0].info.tests: 294 stream.writeln("Note: %s has no user defined tests."%model) 290 # Warn if there are no user defined tests. 291 # Note: the test suite constructed above only has one test in it, which 292 # runs through some smoke tests to make sure the model runs, then runs 293 # through the input-output pairs given in the model definition file. To 294 # check if any such pairs are defined, therefore, we just need to check if 295 # they are in the first test of the test suite. We do this with an 296 # iterator since we don't have direct access to the list of tests in the 297 # test suite. 298 for test in suite: 299 if not test.info.tests: 300 stream.writeln("Note: %s has no user defined tests."%model) 301 break 302 else: 303 stream.writeln("Note: no test suite created --- this should never happen") 295 304 296 305 … … 325 334 models = models[1:] 326 335 elif models and models[0] == 'opencl_and_dll': 327 loaders = ['opencl', 'dll'] 336 loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 328 337 models = models[1:] 329 338 else: 330 loaders = ['opencl', 'dll'] 339 loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 331 340 if not models: 332 341 print("""\ … … 357 366 Run "nosetests sasmodels" on the command line to invoke it. 358 367 """ 359 tests = make_suite(['opencl', 'dll'], ['all']) 368 loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 369 tests = make_suite(loaders, ['all']) 360 370 for test_i in tests: 361 yield test_i.run_all 371 # In order for nosetest to see the correct test name, need to set 372 # the description attribute of the returned function. Since we 373 # can't do this for the returned instance, wrap it in a lambda and 374 # set the description on the lambda. Otherwise we could just do: 375 # yield test_i.run_all 376 L = lambda: test_i.run_all() 377 L.description = test_i.test_name 378 yield L 362 379 363 380
Note: See TracChangeset
for help on using the changeset viewer.