source: anuga_validation/automated_validation_tests/patong_validation/validate_patong.py @ 6609

Last change on this file since 6609 was 6609, checked in by rwilson, 16 years ago

Get working in local mode only, no update from server.

File size: 1.7 KB
Line 
1'''
2Automatic verification that the ANUGA code validates against the patong
3dataset as expected.
4'''
5
6import os
7import glob
8import unittest
9import project
10
11
12class Test_Patong(unittest.TestCase):
13    def setUp(self):
14       
15##        for file in glob.glob('./*.stdout'):
16##            os.remove(file)
17##        for file in glob.glob('./*.sww'):
18##            os.remove(file)
19##        for file in glob.glob('./*.msh'):
20##            os.remove(file)
21
22        # Check that environment variables are defined.
23        if os.getenv(project.ENV_INUNDATIONHOME) is None:
24            msg = ("Environment variable '%s' is not set in project.py"
25                   % project.ENV_INUNDATIONHOME)
26            raise Exception, msg
27
28        if os.getenv(project.ENV_MUXHOME) is None:
29            msg = ("Environment variable '%s' is not set in project.py"
30                   % project.ENV_MUXHOME)
31            raise Exception, msg
32
33    def tearDown(self):
34        # delete all output necessary
35        pass
36
37    def test_that_output_is_as_expected(self):
38        s = 'run_model.py'
39        cmd = 'python %s > %s.stdout' % (s, s)
40        print 'cmd=%s' % cmd
41        res = os.system(cmd)
42        print 'res=%s' % str(res)
43        assert res == 0
44
45        print 'About to run compare_output_with_expected.py'
46        s = 'compare_output_with_expected.py'
47        res = os.system('python %s > %s.stdout'
48                        % (s, s))
49        print 'Result from %s is %d' % (s, res)
50        assert res == 0
51
52################################################################################
53
54if __name__ == "__main__":
55    suite = unittest.makeSuite(Test_Patong, 'test')
56    runner = unittest.TextTestRunner(verbosity=2)
57    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.