Changeset 9566
- Timestamp:
- Jan 31, 2015, 11:47:13 PM (10 years ago)
- Location:
- trunk/anuga_core/source
- Files:
-
- 1 deleted
- 33 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/tests/test_quantity.py
r9562 r9566 1026 1026 indices = inside_polygon(quantity.domain.get_vertex_coordinates(), 1027 1027 polygon) 1028 points = take(quantity.domain.get_vertex_coordinates(), indices)1028 points = num.take(quantity.domain.get_vertex_coordinates(), indices) 1029 1029 1030 1030 answer = linear_function(points) … … 1034 1034 1035 1035 # Check vertices in polygon have been set 1036 assert num.allclose( take(quantity.vertex_values.flat, indices),1036 assert num.allclose(num.take(quantity.vertex_values.flat, indices), 1037 1037 answer) 1038 1038 … … 1040 1040 indices = outside_polygon(quantity.domain.get_vertex_coordinates(), 1041 1041 polygon) 1042 assert num.allclose( take(quantity.vertex_values.flat, indices),1042 assert num.allclose(num.take(quantity.vertex_values.flat, indices), 1043 1043 0.0) 1044 1044 … … 1162 1162 os.remove(txt_file) 1163 1163 1164 def test_set_values_from_lat_long (self):1164 def test_set_values_from_lat_long_2(self): 1165 1165 quantity = Quantity(self.mesh_onslow) 1166 1166 -
trunk/anuga_core/source/anuga/caching/caching.py
r9551 r9566 464 464 set_option('compression', compression) 465 465 except: 466 log _test_error('Set option failed')466 logtesterror('Set option failed') 467 467 468 468 try: … … 506 506 Depfile.write('We are the knights who say NI!') 507 507 Depfile.close() 508 log _test_OK('Wrote file %s' %DepFN)508 logtestOK('Wrote file %s' %DepFN) 509 509 except: 510 log _test_error('Could not open file %s for writing - check your environment' \510 logtesterror('Could not open file %s for writing - check your environment' \ 511 511 % DepFN) 512 512 … … 516 516 set_option('savestat',0) 517 517 assert(options['savestat'] == 0) 518 log _test_OK('Set option')518 logtestOK('Set option') 519 519 except: 520 log _test_error('Set option failed')520 logtesterror('Set option failed') 521 521 522 522 # Make some test input arguments … … 545 545 verbose=verbose, compression=comp) 546 546 if comp: 547 log _test_OK('Caching evaluation with compression')547 logtestOK('Caching evaluation with compression') 548 548 else: 549 log _test_OK('Caching evaluation without compression')549 logtestOK('Caching evaluation without compression') 550 550 except: 551 551 if comp: 552 log _test_error('Caching evaluation with compression failed - try caching.test(compression=0)')552 logtesterror('Caching evaluation with compression failed - try caching.test(compression=0)') 553 553 else: 554 log _test_error('Caching evaluation failed - try caching.test(verbose=1)')554 logtesterror('Caching evaluation failed - try caching.test(verbose=1)') 555 555 556 556 # Retrieve … … 561 561 562 562 if comp: 563 log _test_OK('Caching retrieval with compression')563 logtestOK('Caching retrieval with compression') 564 564 else: 565 log _test_OK('Caching retrieval without compression')565 logtestOK('Caching retrieval without compression') 566 566 except: 567 567 if comp: 568 log _test_error('Caching retrieval with compression failed - try caching.test(compression=0)')568 logtesterror('Caching retrieval with compression failed - try caching.test(compression=0)') 569 569 else: 570 log _test_error('Caching retrieval failed - try caching.test(verbose=1)')570 logtesterror('Caching retrieval failed - try caching.test(verbose=1)') 571 571 572 572 # Reference result … … 576 576 if T1 == T2 and T2 == T3: 577 577 if comp: 578 log _test_OK('Basic caching functionality (with compression)')578 logtestOK('Basic caching functionality (with compression)') 579 579 else: 580 log _test_OK('Basic caching functionality (without compression)')580 logtestOK('Basic caching functionality (without compression)') 581 581 else: 582 log _test_error('Cached result does not match computed result')582 logtesterror('Cached result does not match computed result') 583 583 584 584 … … 589 589 return_filename=1) 590 590 assert(FN[:2] == 'f[') 591 log _test_OK('Return of cache filename')591 logtestOK('Return of cache filename') 592 592 except: 593 log _test_error('Return of cache filename failed')593 logtesterror('Return of cache filename failed') 594 594 595 595 # Test existence of cachefiles … … 599 599 (argsfile,compressed1) = myopen(CD+FN+'_'+file_types[1],"rb",compression) 600 600 (admfile,compressed2) = myopen(CD+FN+'_'+file_types[2],"rb",compression) 601 log _test_OK('Presence of cache files')601 logtestOK('Presence of cache files') 602 602 datafile.close() 603 603 argsfile.close() 604 604 admfile.close() 605 605 except: 606 log _test_error('Expected cache files did not exist')606 logtesterror('Expected cache files did not exist') 607 607 608 608 # Test 'test' function when cache is present … … 614 614 assert(T1 == T4) 615 615 616 log _test_OK("Option 'test' when cache file present")616 logtestOK("Option 'test' when cache file present") 617 617 except: 618 log _test_error("Option 'test' when cache file present failed")618 logtesterror("Option 'test' when cache file present failed") 619 619 620 620 # Test that 'clear' works … … 622 622 #try: 623 623 # cache(f,'clear',verbose=verbose) 624 # log _test_OK('Clearing of cache files')624 # logtestOK('Clearing of cache files') 625 625 #except: 626 # log _test_error('Clear does not work')626 # logtesterror('Clear does not work') 627 627 try: 628 628 cache(f,(a,b,c,N), {'x':x, 'y':y}, verbose=verbose, clear=1) 629 log _test_OK('Clearing of cache files')629 logtestOK('Clearing of cache files') 630 630 except: 631 log _test_error('Clear does not work')631 logtesterror('Clear does not work') 632 632 633 633 … … 638 638 T4 = cache(f,(a,b,c,N), {'x':x, 'y':y}, verbose=verbose, test=1) 639 639 assert(T4 is None) 640 log _test_OK("Option 'test' when cache absent")640 logtestOK("Option 'test' when cache absent") 641 641 except: 642 log _test_error("Option 'test' when cache absent failed")642 logtesterror("Option 'test' when cache absent failed") 643 643 644 644 # Test dependencies … … 650 650 651 651 if T1 == T2: 652 log _test_OK('Basic dependencies functionality')652 logtestOK('Basic dependencies functionality') 653 653 else: 654 log _test_error('Dependencies do not work')654 logtesterror('Dependencies do not work') 655 655 656 656 # Test basic wildcard dependency … … 660 660 661 661 if T1 == T3: 662 log _test_OK('Basic dependencies with wildcard functionality')662 logtestOK('Basic dependencies with wildcard functionality') 663 663 else: 664 log _test_error('Dependencies with wildcards do not work')664 logtesterror('Dependencies with wildcards do not work') 665 665 666 666 … … 676 676 677 677 if T3 is None: 678 log _test_OK('Changed dependencies recognised')678 logtestOK('Changed dependencies recognised') 679 679 else: 680 log _test_error('Changed dependencies not recognised')680 logtesterror('Changed dependencies not recognised') 681 681 682 682 # Test recomputation when dependencies have changed … … 685 685 dependencies=DepFN) 686 686 if T1 == T3: 687 log _test_OK('Recomputed value with changed dependencies')687 logtestOK('Recomputed value with changed dependencies') 688 688 else: 689 log _test_error('Recomputed value with changed dependencies failed')689 logtesterror('Recomputed value with changed dependencies failed') 690 690 691 691 # Performance test (with statistics) … … 706 706 if T1 == T2: 707 707 if t1 > t2: 708 log _test_OK('Performance test: relative time saved = %s pct' \708 logtestOK('Performance test: relative time saved = %s pct' \ 709 709 %str(round((t1-t2)*100/t1,2))) 710 710 else: 711 log _test_error('Basic caching failed for new problem')711 logtesterror('Basic caching failed for new problem') 712 712 713 713 # Test presence of statistics file … … 720 720 fid = open(CD+FN,'r') 721 721 fid.close() 722 log _test_OK('Statistics files present')722 logtestOK('Statistics files present') 723 723 except: 724 log _test_OK('Statistics files cannot be opened')724 logtestOK('Statistics files cannot be opened') 725 725 726 726 print_header_box('Show sample output of the caching function:') … … 742 742 'time.strptime() which is unavailable in Windows') 743 743 744 log _test_OK('Caching self test completed')744 logtestOK('Caching self test completed') 745 745 746 746 … … 768 768 # arguments. 769 769 textwidth3 = 16 # Initial width of separation lines. Is modified. 770 textwidth4 = 50 # Text width in log _test_OK()770 textwidth4 = 50 # Text width in logtestOK() 771 771 statsfile = '.cache_stat' # Basefilename for cached statistics. 772 772 # It will reside in the chosen cache directory. … … 2497 2497 # ----------------------------------------------------------------------------- 2498 2498 2499 def log _test_OK(msg):2499 def logtestOK(msg): 2500 2500 """Print OK msg if test is OK. 2501 2501 2502 2502 USAGE 2503 log _test_OK(message)2503 logtestOK(message) 2504 2504 """ 2505 2505 … … 2512 2512 # ----------------------------------------------------------------------------- 2513 2513 2514 def log _test_error(msg):2514 def logtesterror(msg): 2515 2515 """Print error if test fails. 2516 2516 2517 2517 USAGE 2518 log _test_error(message)2518 logtesterror(message) 2519 2519 """ 2520 2520 -
trunk/anuga_core/source/anuga/caching/tests/test_caching.py
r9551 r9566 218 218 'use_cache': True, 219 219 'vertex_coordinates': None, 220 'verbose': True,220 'verbose': False, 221 221 'max_read_lines': 500, 222 222 'acceptable_overshoot': 1.01, … … 767 767 768 768 769 def Will_fail_ test_objects(self):769 def Will_fail_objects(self): 770 770 """ 771 771 This test shows how instances can't be effectively cached. -
trunk/anuga_core/source/anuga/coordinate_transforms/tests/test_redfearn.py
r9562 r9566 292 292 for forced_zone in [53, 54]: 293 293 294 datafile = join(path, 'test ', 'data', 'projection_test_points_z%d.csv' % forced_zone)294 datafile = join(path, 'tests', 'data', 'projection_test_points_z%d.csv' % forced_zone) 295 295 fid = open(datafile) 296 296 … … 328 328 329 329 path = get_pathname_from_package('anuga.coordinate_transforms') 330 datafile = join(path, 'test ', 'data', 'projection_test_points.csv')330 datafile = join(path, 'tests', 'data', 'projection_test_points.csv') 331 331 fid = open(datafile) 332 332 -
trunk/anuga_core/source/anuga/culvert_flows/tests/test_culvert_class.py
r9472 r9566 141 141 142 142 path = get_pathname_from_package('anuga.culvert_flows') 143 path = os.path.join(path, 'test ', 'data')143 path = os.path.join(path, 'tests', 'data') 144 144 145 145 length = 40. … … 260 260 261 261 path = get_pathname_from_package('anuga.culvert_flows') 262 path = os.path.join(path, 'test ', 'data')262 path = os.path.join(path, 'tests', 'data') 263 263 264 264 length = 40. -
trunk/anuga_core/source/anuga/culvert_flows/tests/test_new_culvert_class.py
r9472 r9566 140 140 141 141 path = get_pathname_from_package('anuga.culvert_flows') 142 path = os.path.join(path, 'test ', 'data')142 path = os.path.join(path, 'tests', 'data') 143 143 144 144 length = 40. … … 257 257 258 258 path = get_pathname_from_package('anuga.culvert_flows') 259 path = os.path.join(path, 'test ', 'data')259 path = os.path.join(path, 'tests', 'data') 260 260 261 261 -
trunk/anuga_core/source/anuga/file/tests/test_csv.py
r9551 r9566 229 229 230 230 path = get_pathname_from_package('anuga.shallow_water') 231 testfile = os.path.join(path, 'test ', 'data', 'polygon_values_example.csv')231 testfile = os.path.join(path, 'tests', 'data', 'polygon_values_example.csv') 232 232 233 233 polygons, values = load_csv_as_polygons(testfile, … … 306 306 307 307 path = get_pathname_from_package('anuga.shallow_water') 308 testfile = os.path.join(path, 'test ', 'data', 'polygon_values_example.csv')308 testfile = os.path.join(path, 'tests', 'data', 'polygon_values_example.csv') 309 309 310 310 polygons, values = load_csv_as_polygons(testfile, … … 386 386 387 387 path = get_pathname_from_package('anuga.shallow_water') 388 testfile = os.path.join(path, 'test ', 'data', 'polygon_values_example.csv')388 testfile = os.path.join(path, 'tests', 'data', 'polygon_values_example.csv') 389 389 390 390 polygons, values = load_csv_as_building_polygons(testfile, -
trunk/anuga_core/source/anuga/file/tests/test_urs.py
r9490 r9566 74 74 75 75 76 def dave_test_URS_points_needed(self):76 def in_development_URS_points_needed(self): 77 77 ll_lat = -21.51667 78 78 ll_long = 114.51667 … … 89 89 verbose=self.verbose) 90 90 91 def X_test_URS_points_neededII(self):92 ll_lat = -21.593 ll_long = 114.594 grid_spacing = 1./60.95 lat_amount = 3096 long_amount = 3097 98 # change this so lats and longs are inputed, then converted99 100 #boundary_polygon = [[7660000,250000],[7660000,280000],101 # [7630000,280000],[7630000,250000]]102 calculate_boundary_points(boundary_polygon, ll_lat, ll_long,103 grid_spacing,104 lat_amount, long_amount,105 verbose=self.verbose)106 91 107 92 def test_URS_points_northern_hemisphere(self): … … 167 152 assert False 168 153 169 def covered_in_other_tests_test_URS_points_needed_poly1(self):154 def in_development_URS_points_needed_poly1(self): 170 155 # Values used for FESA 2007 results 171 156 # domain in southern hemisphere zone 51 … … 194 179 195 180 196 def covered_in_other_tests_test_URS_points_needed_poly2(self):181 def in_development_URS_points_needed_poly2(self): 197 182 # Values used for 2004 validation work 198 183 # domain in northern hemisphere zone 47 -
trunk/anuga_core/source/anuga/file_conversion/tests/test_urs2sts.py
r9490 r9566 29 29 30 30 # Allow us to use helper methods from this test. 31 from anuga.file.test .test_mux import Test_Mux31 from anuga.file.tests.test_mux import Test_Mux 32 32 33 33 class Test_Urs2Sts(Test_Mux): … … 237 237 path = get_pathname_from_package('anuga.shallow_water') 238 238 239 testdir = os.path.join(path, 'test ', 'urs_test_data')239 testdir = os.path.join(path, 'tests', 'urs_test_data') 240 240 ordering_filename=os.path.join(testdir, 'thinned_bound_order_test.txt') 241 241 … … 406 406 path = get_pathname_from_package('anuga.shallow_water') 407 407 408 testdir = os.path.join(path, 'test ', 'urs_test_data')408 testdir = os.path.join(path, 'tests', 'urs_test_data') 409 409 ordering_filename=os.path.join(testdir, 'thinned_bound_order_test.txt') 410 410 -
trunk/anuga_core/source/anuga/file_conversion/tests/test_urs2sww.py
r9562 r9566 26 26 27 27 # use helper methods from other unit test 28 from anuga.file.test .test_mux import Test_Mux28 from anuga.file.tests.test_mux import Test_Mux 29 29 30 30 … … 274 274 ensure_numeric(times_actual)) 275 275 276 276 #Check first value 277 277 stage = fid.variables['stage'][:] 278 278 xmomentum = fid.variables['xmomentum'][:] -
trunk/anuga_core/source/anuga/geometry/tests/test_polygon.py
r9562 r9566 73 73 74 74 # Form absolute filename and read 75 filename = os.path.join( path, 'test ', 'data', 'mainland_only.csv')75 filename = os.path.join( path, 'tests', 'data', 'mainland_only.csv') 76 76 p1 = read_polygon(filename) 77 77 … … 88 88 89 89 # Form absolute filename and read 90 filename = os.path.join( path, 'test ', 'data', 'complex_polygon.csv')90 filename = os.path.join( path, 'tests', 'data', 'complex_polygon.csv') 91 91 # Should cause an Exception 92 92 try: … … 106 106 107 107 # Form absolute filename and read 108 filename = os.path.join( path, 'test ', 'data', 'non_complex_polygon.csv')108 filename = os.path.join( path, 'tests', 'data', 'non_complex_polygon.csv') 109 109 # Should cause an Exception 110 110 try: … … 121 121 122 122 # Form absolute filename and read 123 filename = os.path.join( path, 'test ', 'data', 'complex_polygon.csv')123 filename = os.path.join( path, 'tests', 'data', 'complex_polygon.csv') 124 124 # Should not cause an Exception 125 125 p1 = read_polygon(filename, closed=False) -
trunk/anuga_core/source/anuga/geospatial_data/tests/test_geospatial_data.py
r9562 r9566 918 918 os.remove(pts_file) 919 919 920 def verbose_test_load_pts_blocking(self):920 def test_load_pts_blocking_2(self): 921 921 fileName = tempfile.mktemp('.txt') 922 922 file = open(fileName, 'w') … … 974 974 convert = Geospatial_data(fileName) 975 975 convert.export_points_file(pts_file) 976 results = Geospatial_data(pts_file, max_read_lines=2, verbose= True)976 results = Geospatial_data(pts_file, max_read_lines=2, verbose=False) 977 977 978 978 # Blocking -
trunk/anuga_core/source/anuga/lib/tests/test_maxasc.py
r9562 r9566 92 92 93 93 def test_unequal_lines(self): 94 test_path = aust.get_pathname_from_package('anuga.lib.test ')94 test_path = aust.get_pathname_from_package('anuga.lib.tests') 95 95 in_file = os.path.join(test_path, 'test1.asc') 96 96 expected_file = os.path.join(test_path, 'test1_bad_num_lines.asc') … … 100 100 101 101 def test_headers_differ(self): 102 test_path = aust.get_pathname_from_package('anuga.lib.test ')102 test_path = aust.get_pathname_from_package('anuga.lib.tests') 103 103 in_file = os.path.join(test_path, 'test1.asc') 104 104 expected_file = os.path.join(test_path, 'test1_bad_num_lines.asc') … … 108 108 109 109 def test_wrong_num_columns(self): 110 test_path = aust.get_pathname_from_package('anuga.lib.test ')110 test_path = aust.get_pathname_from_package('anuga.lib.tests') 111 111 in_file = os.path.join(test_path, 'test1.asc') 112 112 expected_file = os.path.join(test_path, 'test1_wrong_num_columns.asc') … … 116 116 117 117 def test_same_input_equals_output1(self): 118 test_path = aust.get_pathname_from_package('anuga.lib.test ')118 test_path = aust.get_pathname_from_package('anuga.lib.tests') 119 119 in_file = os.path.join(test_path, 'test1.asc') 120 120 MaxAsc('test1.out.asc', [in_file]) … … 123 123 124 124 def test_same_input_equals_outputN(self): 125 test_path = aust.get_pathname_from_package('anuga.lib.test ')125 test_path = aust.get_pathname_from_package('anuga.lib.tests') 126 126 in_file = os.path.join(test_path, 'test1.asc') 127 127 MaxAsc('test1.out.asc', [in_file] * 30) … … 129 129 130 130 def test_different_input2(self): 131 test_path = aust.get_pathname_from_package('anuga.lib.test ')131 test_path = aust.get_pathname_from_package('anuga.lib.tests') 132 132 in_file = os.path.join(test_path, 'test1.asc') 133 133 in_file2 = os.path.join(test_path, 'test2.asc') … … 137 137 138 138 def test_different_input3(self): 139 test_path = aust.get_pathname_from_package('anuga.lib.test ')139 test_path = aust.get_pathname_from_package('anuga.lib.tests') 140 140 in_file = os.path.join(test_path, 'test1.asc') 141 141 in_file2 = os.path.join(test_path, 'test2.asc') -
trunk/anuga_core/source/anuga/parallel/tests/test_all.py
r9514 r9566 76 76 # @return A tuple (<files>, <dirs>). 77 77 # @note Don't include any files in and below forbidden directories. 78 def get_ test_files(path):78 def get_unittestfiles(path): 79 79 walk = os.walk(path) 80 80 … … 116 116 117 117 # get all test_*.py and enclosing directories 118 test_files, path_files = get_ test_files(path)118 test_files, path_files = get_unittestfiles(path) 119 119 path_files.sort() 120 120 -
trunk/anuga_core/source/anuga/parallel/tests/test_failure.py
r9501 r9566 88 88 samples = 50 89 89 90 def run_ test(parallel = False, control_data = None, test_points = None, verbose = False):90 def run_simulation(parallel = False, control_data = None, test_points = None, verbose = False): 91 91 success = True 92 92 … … 316 316 317 317 if myid == 0: 318 control_data = run_ test(parallel=False, test_points = test_points, verbose = True)318 control_data = run_simulation(parallel=False, test_points = test_points, verbose = True) 319 319 320 320 for proc in range(1,numprocs): … … 324 324 325 325 pypar.barrier() 326 run_ test(parallel=True, control_data = control_data, test_points = test_points, verbose = True)326 run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = True) 327 327 328 328 -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_boyd_box_op_apron.py
r9501 r9566 96 96 samples = 50 97 97 98 def run_ test(parallel = False, control_data = None, test_points = None, verbose = False):98 def run_simulation(parallel = False, control_data = None, test_points = None, verbose = False): 99 99 success = True 100 100 … … 353 353 354 354 if myid == 0: 355 control_data = run_ test(parallel=False, test_points = test_points, verbose = verbose)355 control_data = run_simulation(parallel=False, test_points = test_points, verbose = verbose) 356 356 357 357 for proc in range(1,numprocs): … … 362 362 363 363 pypar.barrier() 364 run_ test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)364 run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose) 365 365 366 366 -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_boyd_box_operator.py
r9514 r9566 103 103 samples = 50 104 104 105 def run_ test(parallel = False, control_data = None, test_points = None, verbose = False):105 def run_simulation(parallel = False, control_data = None, test_points = None, verbose = False): 106 106 success = True 107 107 … … 318 318 319 319 if myid == 0: 320 control_data = run_ test(parallel=False, test_points = test_points, verbose = verbose)320 control_data = run_simulation(parallel=False, test_points = test_points, verbose = verbose) 321 321 322 322 for proc in range(1,numprocs): … … 327 327 328 328 pypar.barrier() 329 run_ test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)329 run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose) 330 330 331 331 -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_boyd_pipe_operator.py
r9501 r9566 97 97 samples = 50 98 98 99 def run_ test(parallel = False, control_data = None, test_points = None, verbose = False):99 def run_simulation(parallel = False, control_data = None, test_points = None, verbose = False): 100 100 success = True 101 101 … … 344 344 345 345 if myid == 0: 346 control_data = run_ test(parallel=False, test_points = test_points, verbose = verbose)346 control_data = run_simulation(parallel=False, test_points = test_points, verbose = verbose) 347 347 348 348 for proc in range(1,numprocs): … … 353 353 354 354 pypar.barrier() 355 run_ test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)356 357 358 359 355 run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose) 356 357 358 359 -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_distribute_domain.py
r9501 r9566 83 83 # Setup test 84 84 #-------------------------------------------------------------------------- 85 def evolution_test(parallel=False):85 def run_simulation(parallel=False): 86 86 87 87 … … 201 201 if myid == 0: 202 202 if verbose: print 'SEQUENTIAL START' 203 l1norm_seq, l2norm_seq, linfnorm_seq = evolution_test(parallel=False)203 l1norm_seq, l2norm_seq, linfnorm_seq = run_simulation(parallel=False) 204 204 205 205 pypar.barrier() … … 207 207 if verbose: print 'PARALLEL START' 208 208 209 l1norm_par, l2norm_par, linfnorm_par = evolution_test(parallel=True)209 l1norm_par, l2norm_par, linfnorm_par = run_simulation(parallel=True) 210 210 211 211 if myid == 0: -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_file_boundary.py
r9551 r9566 58 58 from anuga.parallel import distribute, myid, numprocs, send, receive, barrier, finalize 59 59 60 from anuga.file.test .test_mux import Test_Mux60 from anuga.file.tests.test_mux import Test_Mux 61 61 62 62 verbose = False … … 70 70 """ 71 71 72 def sequential_t est_time_varying_file_boundary_sts(self):72 def sequential_time_varying_file_boundary_sts(self): 73 73 """sequential_ltest_time_varying_file_boundary_sts_sequential(self): 74 74 Read correct points from ordering file and apply sts to boundary. The boundary is time varying. FIXME add to test_urs2sts. … … 229 229 if myid==0: os.remove(meshname) 230 230 231 def parallel_t est_time_varying_file_boundary_sts(self):231 def parallel_time_varying_file_boundary_sts(self): 232 232 """ parallel_test_time_varying_file_boundary_sts_sequential(self): 233 233 Read correct points from ordering file and apply sts to boundary. -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_frac_op.py
r9501 r9566 97 97 samples = 50 98 98 99 def run_ test(parallel = False, control_data = None, test_points = None, verbose = False):99 def run_simulation(parallel = False, control_data = None, test_points = None, verbose = False): 100 100 success = True 101 101 … … 320 320 321 321 if myid == 0: 322 control_data, success = run_ test(parallel=False, test_points = test_points, verbose = verbose)322 control_data, success = run_simulation(parallel=False, test_points = test_points, verbose = verbose) 323 323 324 324 for proc in range(1,numprocs): … … 329 329 330 330 pypar.barrier() 331 _, success = run_ test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)331 _, success = run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose) 332 332 333 333 sys.stdout.flush() -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_inlet_operator.py
r9501 r9566 102 102 samples = 50 103 103 104 def run_ test(parallel = False, control_data = None, test_points = None, verbose = False):104 def run_simulation(parallel = False, control_data = None, test_points = None, verbose = False): 105 105 success = True 106 106 … … 306 306 307 307 if myid == 0: 308 control_data = run_ test(parallel=False, test_points = test_points, verbose = verbose)308 control_data = run_simulation(parallel=False, test_points = test_points, verbose = verbose) 309 309 310 310 for proc in range(1,numprocs): … … 315 315 316 316 pypar.barrier() 317 run_ test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)317 run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose) 318 318 319 319 -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_riverwall.py
r9433 r9566 62 62 # Setup Test 63 63 ########################################################################## 64 def evolution_test(parallel=False, verbose=False):64 def run_simulation(parallel=False, verbose=False): 65 65 66 66 #-------------------------------------------------------------------------- … … 248 248 #------------------------------------------ 249 249 if myid ==0 and verbose: print 'PARALLEL START' 250 evolution_test(parallel=True, verbose=verbose)250 run_simulation(parallel=True, verbose=verbose) 251 251 finalize() 252 252 -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_shallow_domain.py
r9501 r9566 60 60 mod_path = get_pathname_from_package('anuga.parallel') 61 61 62 mesh_filename = os.path.join( '..','data','merimbula_10785_1.tsh')62 mesh_filename = os.path.join(mod_path,'data','merimbula_10785_1.tsh') 63 63 #mesh_filename = os.path.join('..','data','test-100.tsh') 64 64 yieldstep = 1 … … 86 86 # Setup test 87 87 #-------------------------------------------------------------------------- 88 def evolution_test(parallel=False):88 def run_simulation(parallel=False): 89 89 90 90 … … 150 150 if verbose: print 'PARALLEL START' 151 151 152 evolution_test(parallel=True)152 run_simulation(parallel=True) 153 153 154 154 if myid == 0: -
trunk/anuga_core/source/anuga/parallel/tests/test_parallel_sw_flow.py
r9501 r9566 48 48 # Setup Test 49 49 ########################################################################## 50 def evolution_test(parallel=False, G = None, seq_interpolation_points=None, verbose=False):50 def run_simulation(parallel=False, G = None, seq_interpolation_points=None, verbose=False): 51 51 52 52 #-------------------------------------------------------------------------- … … 199 199 if myid == 0 and verbose: print 'SEQUENTIAL START' 200 200 201 G , interpolation_points = evolution_test(parallel=False,verbose=verbose)201 G , interpolation_points = run_simulation(parallel=False,verbose=verbose) 202 202 G = num.array(G,num.float) 203 203 … … 210 210 if myid ==0 and verbose: print 'PARALLEL START' 211 211 212 evolution_test(parallel=True, G=G, seq_interpolation_points = interpolation_points, verbose= verbose)212 run_simulation(parallel=True, G=G, seq_interpolation_points = interpolation_points, verbose= verbose) 213 213 214 214 finalize() -
trunk/anuga_core/source/anuga/parallel/tests/test_sequential_dist_sw_flow.py
r9501 r9566 60 60 # Setup Test 61 61 ########################################################################## 62 def evolution_test(parallel=False, verbose=False):62 def run_simulation(parallel=False, verbose=False): 63 63 64 64 #-------------------------------------------------------------------------- … … 316 316 if myid ==0 and verbose: print 'PARALLEL START' 317 317 318 evolution_test(parallel=True, verbose=verbose)318 run_simulation(parallel=True, verbose=verbose) 319 319 320 320 finalize() -
trunk/anuga_core/source/anuga/shallow_water/tests/test_data_manager.py
r9550 r9566 62 62 63 63 # use helper methods from other unit test 64 from anuga.file.test .test_mux import Test_Mux64 from anuga.file.tests.test_mux import Test_Mux 65 65 66 66 -
trunk/anuga_core/source/anuga/shallow_water/tests/test_shallow_water_domain.py
r9562 r9566 7240 7240 7241 7241 # Large test set revealed one problem 7242 points_file = os.path.join(path, 'test ', 'data', 'test_points_large.csv')7242 points_file = os.path.join(path, 'tests', 'data', 'test_points_large.csv') 7243 7243 7244 7244 domain.set_quantity('elevation', filename=points_file, … … 7254 7254 7255 7255 # Small test set revealed another problem 7256 points_file = os.path.join(path, 'test ', 'data', 'test_points_small.csv')7256 points_file = os.path.join(path, 'tests', 'data', 'test_points_small.csv') 7257 7257 try: 7258 7258 domain.set_quantity('elevation', filename=points_file, -
trunk/anuga_core/source/anuga/structures/tests/test_inlet_operator.py
r9459 r9566 218 218 219 219 path = get_pathname_from_package('anuga.structures') 220 filename1 = os.path.join(path, 'test ', 'data', 'inlet_operator_test1.tms')221 filename2 = os.path.join(path, 'test ', 'data', 'inlet_operator_test2.tms')220 filename1 = os.path.join(path, 'tests', 'data', 'inlet_operator_test1.tms') 221 filename2 = os.path.join(path, 'tests', 'data', 'inlet_operator_test2.tms') 222 222 223 223 line1 = [[95.0, 10.0], [105.0, 10.0]] … … 278 278 279 279 path = get_pathname_from_package('anuga.structures') 280 filename1 = os.path.join(path, 'test ', 'data', 'inlet_operator_test1.tms')281 filename2 = os.path.join(path, 'test ', 'data', 'inlet_operator_test2.tms')280 filename1 = os.path.join(path, 'tests', 'data', 'inlet_operator_test1.tms') 281 filename2 = os.path.join(path, 'tests', 'data', 'inlet_operator_test2.tms') 282 282 283 283 line1 = [[95.0, 10.0], [105.0, 10.0]] -
trunk/anuga_core/source/anuga/tsunami_source/tests/test_tsunami_okada.py
r9457 r9566 35 35 if T==0: 36 36 # Fortran output file 37 filename = path+sep+'test '+sep+'data'+sep+'fullokada_SP.txt'37 filename = path+sep+'tests'+sep+'data'+sep+'fullokada_SP.txt' 38 38 39 39 # Initial condition of earthquake for multiple source … … 51 51 elif T==1: 52 52 # Fortran output file 53 filename = path+sep+'test '+sep+'data'+sep+'fullokada_SS.txt'53 filename = path+sep+'tests'+sep+'data'+sep+'fullokada_SS.txt' 54 54 55 55 # Initial condition of earthquake for multiple source … … 69 69 70 70 # Fortran output file 71 filename = path+sep+'test '+sep+'data'+sep+'fullokada_MS.txt'71 filename = path+sep+'tests'+sep+'data'+sep+'fullokada_MS.txt' 72 72 73 73 # Initial condition of earthquake for multiple source … … 173 173 if T==0: 174 174 # Fortran output file 175 filename = path+sep+'test '+sep+'data'+sep+'fullokada_SP.txt'175 filename = path+sep+'tests'+sep+'data'+sep+'fullokada_SP.txt' 176 176 177 177 # Initial condition of earthquake for multiple source … … 189 189 elif T==1: 190 190 # Fortran output file 191 filename = path+sep+'test '+sep+'data'+sep+'fullokada_SS.txt'191 filename = path+sep+'tests'+sep+'data'+sep+'fullokada_SS.txt' 192 192 193 193 # Initial condition of earthquake for multiple source … … 207 207 208 208 # Fortran output file 209 filename = path+sep+'test '+sep+'data'+sep+'fullokada_MS.txt'209 filename = path+sep+'tests'+sep+'data'+sep+'fullokada_MS.txt' 210 210 211 211 # Initial condition of earthquake for multiple source -
trunk/anuga_core/source/anuga/utilities/numerical_tools.py
r9562 r9566 389 389 #Initialise module 390 390 391 #from .util_ext import gradient, gradient2391 from .util_ext import gradient, gradient2 392 392 393 393 -
trunk/anuga_core/source/anuga/utilities/tests/test_system_tools.py
r9562 r9566 127 127 path = get_pathname_from_package('anuga.utilities') 128 128 129 filename = os.path.join(path, 'test ', 'data', 'crc_test_file.png')129 filename = os.path.join(path, 'tests', 'data', 'crc_test_file.png') 130 130 131 131 … … 209 209 new_str_list = char_to_string(x) 210 210 211 self. assertTrueEqual(new_str_list, str_list)211 self.failUnlessEqual(new_str_list, str_list) 212 212 213 213 # special test - input list is [''] … … 219 219 new_str_list = char_to_string(x) 220 220 221 self. assertTrueEqual(new_str_list, str_list)221 self.failUnlessEqual(new_str_list, str_list) 222 222 223 223 … … 282 282 new_str_list = self.helper_read_msh_file(FILENAME) 283 283 284 self. assertTrueEqual(new_str_list, str_list)284 self.failUnlessEqual(new_str_list, str_list) 285 285 os.remove(FILENAME) 286 286 … … 295 295 new_str_list = self.helper_read_msh_file(FILENAME) 296 296 297 self. assertTrueEqual(new_str_list, str_list)297 self.failUnlessEqual(new_str_list, str_list) 298 298 os.remove(FILENAME) 299 299 … … 308 308 msg = ("Source: '%s'\nResult: %s\nExpected: %s" 309 309 % (source, str(result), str(expected))) 310 self. assertTrueEqual(result, expected, msg)310 self.failUnlessEqual(result, expected, msg) 311 311 312 312 source = 'fred' -
trunk/anuga_core/source/setup.cfg
r9555 r9566 1 1 2 2 [pytest] 3 addopts = --ignore=anuga/test_all.py --ignore=setup.py --ignore=anuga/build --ignore=anuga/parallel --cov-report term --cov . 3 addopts = --ignore=anuga/test_all.py 4 --ignore=build 5 --ignore=setup.py 6 --ignore=anuga/build 7 --ignore=anuga/parallel 8 --cov-report term --cov .
Note: See TracChangeset
for help on using the changeset viewer.