Last change
on this file since 6528 was
6528,
checked in by rwilson, 16 years ago
|
Start the Patong auto validation stuff.
|
File size:
1.5 KB
|
Line | |
---|
1 | ''' |
---|
2 | Automatic verification that the ANUGA code validates against the patong |
---|
3 | dataset as expected. |
---|
4 | ''' |
---|
5 | |
---|
6 | import os |
---|
7 | import glob |
---|
8 | import unittest |
---|
9 | import project |
---|
10 | |
---|
11 | |
---|
12 | class Test_Patong(unittest.TestCase): |
---|
13 | def setUp(self): |
---|
14 | # Remove garbage |
---|
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 test_that_output_is_as_expected(self): |
---|
34 | s = 'run_model.py' |
---|
35 | res = os.system('python %s > run_patong.stdout' % s) |
---|
36 | assert res == 0 |
---|
37 | |
---|
38 | s = 'compare_output_with_expected.py' |
---|
39 | res = os.system('python %s > compare_output_with_expected.py.stdout' |
---|
40 | % s) |
---|
41 | assert res == 0 |
---|
42 | |
---|
43 | ################################################################################ |
---|
44 | |
---|
45 | if __name__ == "__main__": |
---|
46 | suite = unittest.makeSuite(Test_Patong, 'test') |
---|
47 | runner = unittest.TextTestRunner(verbosity=2) |
---|
48 | runner.run(suite) |
---|
Note: See
TracBrowser
for help on using the repository browser.