source: anuga_validation/automated_validation_tests/okushiri_tank_validation/validate_okushiri.py @ 5959

Last change on this file since 5959 was 5183, checked in by ole, 17 years ago

Implemented a workaround the problem described in ticket:235
Windows machines will now do the automatic testing without attempting to plot.

File size: 1.9 KB
Line 
1"""Automatic verification that the ANUGA code validates against the okushiri
2dataset as expected. See anuga_validation/okushiri_2005 for more details
3"""
4
5import unittest
6import os
7
8
9class Test_Okushiri(unittest.TestCase):
10    def setUp(self):
11       
12        # Remove garbage
13        for file in os.listdir('.'):
14            if file.endswith('.stdout') or\
15               file.endswith('.sww') or\
16               file.endswith('.msh'):
17                os.remove(file)
18               
19       
20    def tearDown(self):
21        pass
22
23    def test_that_output_is_as_expected(self):
24
25       
26        #print
27        s = 'create_okushiri.py'
28        #print s
29        res = os.system('python %s > create_okushiri.stdout' %s)
30        assert res == 0
31
32        s = 'run_okushiri.py'
33        #print s       
34        res = os.system('python %s > run_okushiri.stdout' %s)       
35        assert res == 0
36       
37       
38        s = 'compare_timeseries_with_measures.py'
39        #print s
40        res = os.system('python %s > compare_timeseries_with_measures.stdout'\
41                        %s)
42        assert res == 0
43
44    def manual_test_that_output_is_as_expected(self):
45        from run_okushiri import main
46        from create_okushiri import create_mesh
47
48        # Note, this has not been tested when code is failing.
49        # Next step, use the parrameter elevation_in_mesh
50        # and only run create_okishiri once for speed.
51       
52        res = create_mesh()
53        assert res == None
54       
55        res = main()
56        assert res == None
57       
58        s = 'compare_timeseries_with_measures.py'
59        #print s
60        res = os.system('python %s > compare_timeseries_with_measures.stdout'\
61                        %s)
62        assert res == 0
63       
64
65#-------------------------------------------------------------
66if __name__ == "__main__":
67    suite = unittest.makeSuite(Test_Okushiri,'test')
68    runner = unittest.TextTestRunner(verbosity=2)
69    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.