Ignore:
Timestamp:
Dec 19, 2008, 10:38:08 AM (15 years ago)
Author:
rwilson
Message:

Changes to handle large files when Scientific.IO.NetCDF provides the feature.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/test_all.py

    r4978 r6086  
    2020exclude_files = []
    2121
    22 #if sys.platform != 'win32': 
     22#if sys.platform != 'win32':
    2323#    exclude_files.append('test_advection.py') #Weave doesn't work on Linux
    24 
    2524# Exclude test_advection on all platforms for the time being. See ticket:205
    2625#exclude_files.append('test_advection.py') #Weave doesn't work on Linux
    2726
     27# Directories that should not be searched for test files.
    2828
    29 # Directories that should not be searched for test files.   
    30 exclude_dirs = ['pypar_dist', #Special requirements
     29exclude_dirs = ['pypar_dist',                        #Special requirements
    3130                'props', 'wcprops', 'prop-base', 'text-base', '.svn', #Svn
    3231                'tmp']
    33 
    3432
    3533print "The following directories will be skipped over;"
     
    3836print ""
    3937
     38
    4039def get_test_files(path):
    41 
    42 
    4340    try:
    4441        files = os.listdir(path)
     
    5350    path_files = []
    5451    for file in files:
    55 
    5652        absolute_filename = path + os.sep + file
    5753
    5854        #sys.path.append('pmesh')
    5955        if os.path.isdir(absolute_filename):
    60             sys.path.append(file) #FIXME: May cause name conflicts between pyvolution\mesh.py and pmesh\mesh.py on some systems
     56            # FIXME: May cause name conflicts between pyvolution\mesh.py and
     57            #        pmesh\mesh.py on some systems
     58            sys.path.append(file)
    6159            path_files.append(file)
    62             print  file + ',',
    63             more_test_files, more_path_files =\
    64                              get_test_files(absolute_filename)
    65            
     60            print file + ',',
     61            more_test_files, more_path_files = \
     62                    get_test_files(absolute_filename)
    6663            test_files += more_test_files
    6764            path_files += more_path_files
     
    7067        else:
    7168            pass
    72        
     69
    7370    return test_files, path_files
    74 
    7571
    7672
     
    8379
    8480    files.sort() # Ensure same order on all platforms
    85    
     81
    8682    print
    8783    print
     
    8985    print
    9086    print 'Files tested;'
    91     #print_files = []
    9287    for file in files:
    93         #print_files += file + ' '
    9488        print file + ',',
    9589    print
     
    9892        for file in exclude_files:
    9993            print 'WARNING: File '+ file + ' to be excluded from testing'
    100             try:   
     94            try:
    10195                files.remove(file)
    10296            except ValueError, e:
    103                 msg = 'File "%s" was not found in test suite.\n' %file
    104                 msg += 'Original error is "%s"\n' %e
    105                 msg += 'Perhaps it should be removed from exclude list?' 
     97                msg = 'File "%s" was not found in test suite.\n' % file
     98                msg += 'Original error is "%s"\n' % e
     99                msg += 'Perhaps it should be removed from exclude list?'
    106100                raise Exception, msg
    107101
     
    109103    moduleNames = map(filenameToModuleName, files)
    110104    modules = map(__import__, moduleNames)
    111    
     105
    112106    # Fix up the system path
    113107    for file in path_files:
    114108        sys.path.remove(file)
    115        
     109
    116110    load = unittest.defaultTestLoader.loadTestsFromModule
    117111    testCaseClasses = map(load, modules)
    118112
    119    
    120113    if test_verbose is True:
    121114        # Test the code by setting verbose to True.
     
    128121                    # these are the test functions
    129122                    try:
    130                         # Calls class method set_verbose in the test case classes
    131                         # print 'Tests', tests._tests[0]
    132                         # print 'Type', type(tests._tests[0])                       
     123                        # Calls class method set_verbose in test case classes
    133124                        tests._tests[0].set_verbose()
    134125                    except:
    135                         pass # No all classes have set_verbose
     126                        pass                # No all classes have set_verbose
    136127    return unittest.TestSuite(testCaseClasses)
     128
    137129
    138130def check_anuga_import():
     
    143135        print "Python cannot import ANUGA module."
    144136        print "Check you have followed all steps of its installation."
    145         import sys; sys.exit()
     137        import sys
     138        sys.exit()
    146139
    147    
     140
    148141if __name__ == '__main__':
    149142    check_anuga_import()
     143
    150144    if len(sys.argv) > 1 and sys.argv[1][0].upper() == 'V':
    151145        test_verbose = True
    152         saveout = sys.stdout   
     146        saveout = sys.stdout
    153147        filename = ".temp"
    154148        fid = open(filename, 'w')
    155149        sys.stdout = fid
    156150    else:
    157         test_verbose = False       
     151        test_verbose = False
    158152    suite = regressionTest(test_verbose)
    159153    runner = unittest.TextTestRunner() #verbosity=2
    160154    runner.run(suite)
    161    
     155
    162156    # Cleaning up
    163157    if len(sys.argv) > 1 and sys.argv[1][0].upper() == 'V':
    164         sys.stdout = saveout 
     158        sys.stdout = saveout
    165159        #fid.close() # This was causing an error in windows
    166160        #os.remove(filename)
Note: See TracChangeset for help on using the changeset viewer.