Changeset 7dd309a in sasview for src/sas


Ignore:
Timestamp:
Jul 26, 2018 8:38:08 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
573c383
Parents:
dc71408
git-author:
Piotr Rozyczko <rozyczko@…> (07/26/18 08:37:44)
git-committer:
Piotr Rozyczko <rozyczko@…> (07/26/18 08:38:08)
Message:

Improved failure/error display

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/GUITests.py

    r144fe21 r7dd309a  
    1515 
    1616To get more verbose console output (recommended), use ``python GUITests.py -v`` 
    17 or modify tge VERBOSITY module variable. 
    1817""" 
    1918 
     
    2827    'perspectivesSuite', 
    2928    ] 
    30  
    31 # Define output verbosity 
    32 #VERBOSITY = 0 # quiet - just the total number of tests run and global result 
    33 VERBOSITY = 1 # default - quiet + a dot for every successful test or a F for failure 
    34 #VERBOSITY = 2 # verbose - default + help string of every test and the result 
    3529 
    3630# Prepare the general QApplication instance 
     
    196190    if len(sys.argv) > 1: 
    197191        user_suites = sys.argv[1:] 
    198  
    199     runner = unittest.TextTestRunner(verbosity=VERBOSITY) 
     192    errors = {} 
    200193    for suite in user_suites: 
    201194        # create the suite object from name 
    202195        try: 
     196 
    203197            suite_instance = globals()[suite]() 
    204             results = runner.run(suite_instance) 
     198            result=unittest.TextTestResult(sys.stdout,True,True) 
     199            print("\nRunning %d test cases for %s"%(suite_instance.countTestCases(), suite)) 
     200            result.buffer=True 
     201            suite_instance.run(result) 
     202 
     203            if not result.wasSuccessful(): 
     204                if len(result.errors) or len(result.failures): 
     205                    errors[suite] = (result.errors, result.failures) 
     206                if len(result.errors): 
     207                    print("\n============ Errors disovered ===================") 
     208                if len(result.failures): 
     209                    print("\n============ Failures disovered =================") 
     210            else: 
     211                print("\nAll tests successful") 
     212 
    205213        except KeyError: 
     214            print("Failure : %s "%str(ex)) 
    206215            print("ERROR: Incorrect suite name: %s " % suite) 
    207216            pass 
     217 
     218    if len(errors.keys())>0: 
     219        for suite, errors in errors.items(): 
     220            for r in errors[0]: 
     221                    print("\nSuite: %s had following errors:\n %s : %s"%(suite, r[0], r[1])) 
     222            for r in errors[1]: 
     223                    print("\nSuite: %s had following failures:\n %s : %s"%(suite, r[0], r[1])) 
     224            print("=================================================") 
Note: See TracChangeset for help on using the changeset viewer.