Changeset 6c00702 in sasview for test/utest_sansview.py


Ignore:
Timestamp:
Apr 4, 2014 10:44:59 AM (10 years ago)
Author:
pkienzle
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d44648e
Parents:
e6d9703
Message:

correct fitting tests so that they run (though not yet automatically)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/utest_sansview.py

    rbbd97e5 r6c00702  
    2626#    COMMAND_SEP = '&' 
    2727 
    28 def run_tests(): 
     28def run_tests(dirs=None, all=False): 
    2929    test_root = os.path.abspath(os.path.dirname(__file__)) 
    3030    run_one_py = os.path.join(test_root, 'run_one.py') 
     
    3535    n_failures = 0 
    3636     
    37     for d in os.listdir(test_root): 
     37    for d in (dirs if dirs else os.listdir(test_root)): 
    3838         
    3939        # Check for modules to be skipped 
     
    7676                        passed += 1 
    7777                        print "Result for %s: SUCCESS" % module_name 
    78                          
     78 
    7979    print "\n----------------------------------------------" 
    80     print "Results by test modules:" 
    81     print "    PASSED: %d" % passed 
    82     ratio = 100.0*failed/(failed+passed) 
    83     print "    FAILED: %d    (%.0f%%)" % (failed,ratio)  
    84      
    85     print "Results by tests:" 
    86     print "    Tests run:    %d" % n_tests 
    87     print "    Tests failed: %d" % n_failures 
    88     print "    Test errors:  %d" % n_errors  
     80    if n_tests == 0: 
     81        print "No tests." 
     82    else: 
     83        print "Results by test modules:" 
     84        print "    PASSED: %d" % passed 
     85        ratio = 100.0*failed/(failed+passed) 
     86        print "    FAILED: %d    (%.0f%%)" % (failed,ratio) 
     87 
     88        print "Results by tests:" 
     89        print "    Tests run:    %d" % n_tests 
     90        print "    Tests failed: %d" % n_failures 
     91        print "    Test errors:  %d" % n_errors 
    8992    print "----------------------------------------------" 
    9093     
     
    9295 
    9396if __name__ == '__main__': 
    94     if run_tests()>0: 
     97    all = (len(sys.argv) > 1 and sys.argv[1] == '-all') 
     98    dirs = sys.argv[1:] if not all else sys.argv[2:] 
     99    if run_tests(dirs=dirs, all=all)>0: 
    95100        sys.exit(1) 
    96101     
Note: See TracChangeset for help on using the changeset viewer.