Changeset 3994
- Timestamp:
- Nov 15, 2006, 9:32:12 AM (18 years ago)
- 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 1166 1166 assert access(root_dir,F_OK) 1167 1167 1168 add_directories(root_dir, directories) 1169 assert access(root_dir,F_OK) 1170 1168 1171 #clean up! 1169 1172 os.rmdir(kens_dir) … … 1172 1175 os.rmdir(root_dir) 1173 1176 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 1174 1194 #------------------------------------------------------------- 1175 1195 if __name__ == "__main__": -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r3984 r3994 7 7 import anuga.utilities.polygon 8 8 import sys 9 import os 9 10 10 11 from os import remove, mkdir, access, F_OK, sep … … 1209 1210 print 'Files %s and %s copied' %(filename1, filename2) 1210 1211 1212 1211 1213 def add_directories(root_directory, directories): 1212 1214 """ … … 1221 1223 dir = root_directory 1222 1224 for new_dir in directories: 1223 dir = dir + sep + new_dir1225 dir = os.path.join(dir, new_dir) 1224 1226 if not access(dir,F_OK): 1225 1227 mkdir (dir)
Note: See TracChangeset
for help on using the changeset viewer.