Changeset 9437


Ignore:
Timestamp:
Jan 20, 2015, 4:17:32 PM (10 years ago)
Author:
steve
Message:

Cleaned up unit tests in anuga.utilities folder

Location:
trunk/anuga_core/source/anuga
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/geometry/test_polygon.py

    r9213 r9437  
    7272
    7373        # Form absolute filename and read
    74         filename = path + sep + 'mainland_only.csv'
     74        filename = path + sep + 'data' + sep + 'mainland_only.csv'
    7575        p1 = read_polygon(filename)
    7676
     
    8787
    8888        # Form absolute filename and read
    89         filename = path + sep + 'complex_polygon.csv'
     89        filename = path + sep + 'data' + sep +  'complex_polygon.csv'
    9090        # Should cause an Exception
    9191        try:
     
    105105
    106106        # Form absolute filename and read
    107         filename = path + sep + 'non_complex_polygon.csv'
     107        filename = path + sep + 'data' + sep +  'non_complex_polygon.csv'
    108108        # Should cause an Exception
    109109        try:
     
    120120
    121121        # Form absolute filename and read
    122         filename = path + sep + 'complex_polygon.csv'
     122        filename = path + sep + 'data' + sep +  'complex_polygon.csv'
    123123        # Should not cause an Exception
    124124        p1 = read_polygon(filename, closed=False)
  • trunk/anuga_core/source/anuga/utilities/test/test_cg_solve.py

    r9435 r9437  
    44class TestError(exceptions.Exception): pass
    55import unittest
     6
     7import os
    68
    79import numpy as num
     
    1214
    1315class Test_CG_Solve(unittest.TestCase):
     16   
     17    def tearDown(self):
     18        try:
     19            os.remove('anuga.log')
     20        except:
     21            pass
    1422
    1523    def test_sparse_solve(self):
  • trunk/anuga_core/source/anuga/utilities/test/test_csv_tools.py

    r9435 r9437  
    66import csv
    77
    8 import csv_tools
     8import anuga.utilities.csv_tools as csv_tools
    99
    1010
  • trunk/anuga_core/source/anuga/utilities/test/test_data_audit.py

    r9435 r9437  
    55import os
    66
    7 from data_audit import *
     7from anuga.utilities.data_audit import *
    88
    99
  • trunk/anuga_core/source/anuga/utilities/test/test_file_utils.py

    r9435 r9437  
    77from anuga.utilities.file_utils import copy_code_files, get_all_swwfiles
    88from anuga.utilities.file_utils import del_dir
    9 from sww_merge import sww_merge, _sww_merge
     9from anuga.utilities.sww_merge import sww_merge, _sww_merge
    1010
    1111
  • trunk/anuga_core/source/anuga/utilities/test/test_log_analyser.py

    r9435 r9437  
    7575        os.rmdir(dir2)
    7676        os.rmdir(root_dir)
     77        os.remove(output_file)
     78        #os.remove(log_file_name)
    7779
    7880
  • trunk/anuga_core/source/anuga/utilities/test/test_plot_utils.py

    r9435 r9437  
    3636
    3737        domain=anuga.create_domain_from_file('test_plot_utils.msh')
     38       
     39        os.remove('test_plot_utils.msh')
    3840
    3941        # 05/05/2014 -- riverwalls only work with DE0 and DE1
     
    251253            self.basic_tests()
    252254
     255        os.remove('test_plot_utils.sww')
     256       
     257
    253258    def test_timeslices(self):
    254259        """
     
    262267            self.velExtrap_timeSlices_test(ve=True)
    263268            self.velExtrap_timeSlices_test(ve=False)
     269           
     270        os.remove('test_plot_utils.sww')
    264271
    265272    def test_quantity_consistency(self):
     
    275282            l=len(pc.time)-1
    276283            self.quantity_consistency_check(pc,l)
     284           
     285        os.remove('test_plot_utils.sww')
    277286     
    278287
     
    319328        dt_Prd=( (pc.x[nt[0]]-25.)/ll + (pc.y[nt[0]]-10.)*0.5/ll)
    320329        assert(np.allclose(dt_Prd , nt[1]))
     330       
     331        os.remove('test_plot_utils.sww')
    321332
    322333    def test_triangle_areas(self):
     
    348359        len_b = (x2-x0)*vec_01_perp[0] + (y2-y0)*vec_01_perp[1]
    349360        assert(np.allclose(abs(0.5*len_a*len_b),ta[0]))
     361       
     362        os.remove('test_plot_utils.sww')
    350363
    351364    def test_water_volume(self):
     
    365378        wv=util.water_volume(p,pc)
    366379        assert(np.allclose(wVol_2, wv[2]))
     380       
     381        os.remove('test_plot_utils.sww')
    367382
    368383    def test_Make_Geotif(self):
  • trunk/anuga_core/source/anuga/utilities/test/test_quantity_setting_functions.py

    r9435 r9437  
    5656
    5757        domain=anuga.create_domain_from_file('test_quantity_setting_functions.msh')
     58       
     59        os.remove('test_quantity_setting_functions.msh')
    5860
    5961        domain.set_flow_algorithm(flowAlg)
     
    236238        ###########################################################################
    237239        # This example should fail (since the clip_range minimum >= maximum)
    238         def should_fail():
     240        def should_fail_1():
    239241            F=qs.composite_quantity_setting_function([[trenchPoly, f0], ['All', 'PointData_ElevTest.tif']],\
    240242                                                    domain,
    241243                                                    clip_range = [[ -500., -1000.], [-1.0e+100, 1.0e+100]])
    242244            return
    243         self.assertRaises(Exception, lambda: should_fail())
     245        self.assertRaises(Exception, lambda: should_fail_1())
    244246
    245247        return
  • trunk/anuga_core/source/anuga/utilities/test/test_sparse.py

    r9435 r9437  
    44from math import sqrt
    55
    6 from sparse import *
     6from anuga.utilities.sparse import *
    77import numpy as num
    88
  • trunk/anuga_core/source/anuga/utilities/test/test_system_tools.py

    r9435 r9437  
    129129            path = '.' + sep
    130130
    131         filename = path + sep + 'crc_test_file.png'
     131        filename = path + sep + '..' + sep + 'data' + sep + 'crc_test_file.png'
    132132
    133133        ref_crc = 1203293305 # Computed on Windows box
  • trunk/anuga_core/source/anuga/utilities/test/test_xml_tools.py

    r9435 r9437  
    77import os
    88
    9 from xml_tools import *
     9from anuga.utilities.xml_tools import *
    1010
    1111class Test_xml_tools(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.