Changeset 3994


Ignore:
Timestamp:
Nov 15, 2006, 9:32:12 AM (18 years ago)
Author:
duncan
Message:

tweaks

Location:
anuga_core/source/anuga/abstract_2d_finite_volumes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py

    r3983 r3994  
    11661166        assert access(root_dir,F_OK)
    11671167
     1168        add_directories(root_dir, directories)
     1169        assert access(root_dir,F_OK)
     1170       
    11681171        #clean up!
    11691172        os.rmdir(kens_dir)
     
    11721175        os.rmdir(root_dir)
    11731176
     1177    def test_add_directories_bad(self):
     1178       
     1179        import tempfile
     1180        root_dir = tempfile.mkdtemp('_test_util', 'test_util_')
     1181        directories = ['**','ne','ke']
     1182       
     1183        try:
     1184            kens_dir = add_directories(root_dir, directories)
     1185        except OSError:
     1186            pass
     1187        else:
     1188            msg = 'bad dir name should give OSError'
     1189            raise Exception(msg)   
     1190           
     1191        #clean up!
     1192        os.rmdir(root_dir)
     1193       
    11741194#-------------------------------------------------------------
    11751195if __name__ == "__main__":
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r3984 r3994  
    77import anuga.utilities.polygon
    88import sys
     9import os
    910
    1011from os import remove, mkdir, access, F_OK, sep
     
    12091210    print 'Files %s and %s copied' %(filename1, filename2)
    12101211
     1212
    12111213def add_directories(root_directory, directories):
    12121214    """
     
    12211223    dir = root_directory
    12221224    for new_dir in directories:
    1223         dir = dir + sep + new_dir
     1225        dir = os.path.join(dir, new_dir)
    12241226        if not access(dir,F_OK):
    12251227            mkdir (dir)
Note: See TracChangeset for help on using the changeset viewer.