Changeset a69d8cd in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Jan 26, 2018 9:13:22 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
ecb485c
Parents:
49284e1
Message:

add support for pytest and use it on travis/appveyor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    r2d81cfe ra69d8cd  
    123123 
    124124        if is_py:  # kernel implemented in python 
    125             test_name = "Model: %s, Kernel: python"%model_name 
     125            test_name = "%s-python"%model_name 
    126126            test_method_name = "test_%s_python" % model_info.id 
    127127            test = ModelTestCase(test_name, model_info, 
     
    135135            # test using dll if desired 
    136136            if 'dll' in loaders or not core.HAVE_OPENCL: 
    137                 test_name = "Model: %s, Kernel: dll"%model_name 
     137                test_name = "%s-dll"%model_name 
    138138                test_method_name = "test_%s_dll" % model_info.id 
    139139                test = ModelTestCase(test_name, model_info, 
     
    146146            # test using opencl if desired and available 
    147147            if 'opencl' in loaders and core.HAVE_OPENCL: 
    148                 test_name = "Model: %s, Kernel: OpenCL"%model_name 
     148                test_name = "%s-opencl"%model_name 
    149149                test_method_name = "test_%s_opencl" % model_info.id 
    150150                # Using dtype=None so that the models that are only 
     
    469469    loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 
    470470    tests = make_suite(loaders, ['all']) 
    471     for test_i in tests: 
    472         # In order for nosetest to see the correct test name, need to set 
    473         # the description attribute of the returned function.  Since we 
    474         # can't do this for the returned instance, wrap it in a lambda and 
    475         # set the description on the lambda.  Otherwise we could just do: 
    476         #    yield test_i.run_all 
    477         L = lambda: test_i.run_all() 
    478         L.description = test_i.test_name 
    479         yield L 
     471    for test in tests: 
     472        # In order for nosetest to show the test name, wrap the test.run_all 
     473        # instance in function that takes the test name as a parameter which 
     474        # will be displayed when the test is run. 
     475        yield lambda name: test.run_all(), test.test_name 
    480476 
    481477 
Note: See TracChangeset for help on using the changeset viewer.