Changeset 3221de0 in sasmodels for sasmodels/model_test.py
- Timestamp:
- Feb 1, 2018 9:40:30 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- b4272a2
- Parents:
- b3af1c2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
rf354e46 r3221de0 62 62 from .exception import annotate_exception 63 63 from .modelinfo import expand_pars 64 from .kernelcl import use_opencl 64 65 65 66 # pylint: disable=unused-import … … 134 135 135 136 # test using dll if desired 136 if 'dll' in loaders or not core.HAVE_OPENCL:137 if 'dll' in loaders or not use_opencl(): 137 138 test_name = "%s-dll"%model_name 138 139 test_method_name = "test_%s_dll" % model_info.id … … 145 146 146 147 # test using opencl if desired and available 147 if 'opencl' in loaders and core.HAVE_OPENCL:148 if 'opencl' in loaders and use_opencl(): 148 149 test_name = "%s-opencl"%model_name 149 150 test_method_name = "test_%s_opencl" % model_info.id … … 367 368 368 369 # Build a test suite containing just the model 369 loaders = ['opencl'] if core.HAVE_OPENCLelse ['dll']370 loaders = ['opencl'] if use_opencl() else ['dll'] 370 371 models = [model] 371 372 try: … … 424 425 verbosity = 1 425 426 if models and models[0] == 'opencl': 426 if not core.HAVE_OPENCL:427 if not use_opencl(): 427 428 print("opencl is not available") 428 429 return 1 … … 434 435 models = models[1:] 435 436 elif models and models[0] == 'opencl_and_dll': 436 loaders = ['opencl', 'dll'] if core.HAVE_OPENCLelse ['dll']437 loaders = ['opencl', 'dll'] if use_opencl() else ['dll'] 437 438 models = models[1:] 438 439 else: 439 loaders = ['opencl', 'dll'] if core.HAVE_OPENCLelse ['dll']440 loaders = ['opencl', 'dll'] if use_opencl() else ['dll'] 440 441 if not models: 441 442 print("""\ … … 466 467 Run "nosetests sasmodels" on the command line to invoke it. 467 468 """ 468 loaders = ['opencl', 'dll'] if core.HAVE_OPENCLelse ['dll']469 loaders = ['opencl', 'dll'] if use_opencl() else ['dll'] 469 470 tests = make_suite(loaders, ['all']) 470 471 def build_test(test): … … 476 477 # variable test will be shared amongst all the tests, and we will be 477 478 # repeatedly testing vesicle. 478 return lambda name: test.run_all(), test.test_name 479 480 # Note: in sasview sas.sasgui.perspectives.fitting.gpu_options 481 # requires that the test.description field be set. 482 wrap = lambda: test.run_all() 483 wrap.description = test.test_name 484 return wrap 485 # The following would work with nosetests and pytest: 486 # return lambda name: test.run_all(), test.test_name 487 479 488 for test in tests: 480 489 yield build_test(test)
Note: See TracChangeset
for help on using the changeset viewer.