Changeset 33e475a in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Aug 26, 2017 8:17:30 PM (7 years ago)
Author:
paperspace <paperspace@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
573ffab
Parents:
d439007 (diff), bedb9b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/SasView/sasmodels.git

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    rbb4b509 rbedb9b0  
    4747import sys 
    4848import unittest 
     49 
     50try: 
     51    from StringIO import StringIO 
     52except ImportError: 
     53    # StringIO.StringIO renamed to io.StringIO in Python 3 
     54    # Note: io.StringIO exists in python 2, but using unicode instead of str 
     55    from io import StringIO 
    4956 
    5057import numpy as np  # type: ignore 
     
    337344 
    338345def run_one(model): 
    339     # type: (str) -> None 
     346    # type: (str) -> str 
    340347    """ 
    341348    Run the tests for a single model, printing the results to stdout. 
     
    350357 
    351358    # Build a object to capture and print the test results 
    352     stream = _WritelnDecorator(sys.stdout)  # Add writeln() method to stream 
     359    stream = _WritelnDecorator(StringIO())  # Add writeln() method to stream 
    353360    verbosity = 2 
    354361    descriptions = True 
     
    388395    else: 
    389396        stream.writeln("Note: no test suite created --- this should never happen") 
     397 
     398    output = stream.getvalue() 
     399    stream.close() 
     400    return output 
    390401 
    391402 
Note: See TracChangeset for help on using the changeset viewer.