Changeset 3c852d4 in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Oct 10, 2016 9:30:02 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:
479d0f3
Parents:
ed10b57
Message:

use public api to access test suite (refs #706)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    r897ca7f r3c852d4  
    288288        stream.writeln(tb) 
    289289 
    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") 
    295304 
    296305 
Note: See TracChangeset for help on using the changeset viewer.