Changeset 9bc4882 in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Sep 5, 2017 11:01:03 AM (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:
8db25bf
Parents:
acc6c8f (diff), 142a8e2 (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' into ticket-776-orientation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    r73cbc5b r9bc4882  
    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.