Changeset 479d0f3 in sasmodels


Ignore:
Timestamp:
Oct 10, 2016 11:17:15 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
8f93522, e77872e
Parents:
3c852d4
Message:

run_one() uses dll if OpenCL is not available. Fixes #706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    r3c852d4 r479d0f3  
    121121 
    122122            # test using dll if desired 
    123             if 'dll' in loaders: 
     123            if 'dll' in loaders or not core.HAVE_OPENCL: 
    124124                test_name = "Model: %s, Kernel: dll"%model_name 
    125125                test_method_name = "test_%s_dll" % model_info.id 
     
    270270 
    271271    # Build a test suite containing just the model 
    272     loaders = ['opencl'] 
     272    loaders = ['opencl'] if core.HAVE_OPENCL else ['dll'] 
    273273    models = [model] 
    274274    try: 
     
    334334        models = models[1:] 
    335335    elif models and models[0] == 'opencl_and_dll': 
    336         loaders = ['opencl', 'dll'] 
     336        loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 
    337337        models = models[1:] 
    338338    else: 
    339         loaders = ['opencl', 'dll'] 
     339        loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 
    340340    if not models: 
    341341        print("""\ 
     
    366366    Run "nosetests sasmodels" on the command line to invoke it. 
    367367    """ 
    368     tests = make_suite(['opencl', 'dll'], ['all']) 
     368    loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 
     369    tests = make_suite(loaders, ['all']) 
    369370    for test_i in tests: 
    370         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 
    371379 
    372380 
Note: See TracChangeset for help on using the changeset viewer.