Changeset 7666
- Timestamp:
- Mar 17, 2010, 2:33:19 PM (15 years ago)
- Location:
- anuga_validation/automated_validation_tests/patong_beach_validation
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/automated_validation_tests/patong_beach_validation/validate_patong_scenario.py
r7653 r7666 5 5 import unittest 6 6 import os 7 from subprocess import Popen, PIPE 8 9 10 def get_free_memory(): 11 """Get available memory. Linux only. 12 """ 13 14 p = Popen('free', shell=True, 15 stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) 16 17 if p.stdout is not None: 18 for line in p.stdout.readlines(): 19 if line.startswith('Mem'): 20 fields = line.split() 21 mem = int(fields[1]) # Total memory 22 else: 23 mem = None 24 25 26 return mem 7 27 8 28 … … 19 39 pass 20 40 21 def test_ inflow_using_flowline(self):41 def test_patong_validation(self): 22 42 """Exercise Patong Validation Scenario for three resolutions and 23 43 compare timeseries from modelled results against reference model. 24 44 """ 45 46 # Bail out if there is insufficient memory. 47 # This works only on *nix systems 48 mem = get_free_memory() 49 if mem is None: 50 msg = 'No information about available memory: ' 51 msg += 'Skipping Patong beach validation' 52 raise Exception(msg) 53 54 if mem < 8000000: 55 msg = 'Insufficient memory to run Patong beach validation. ' 56 msg += 'Got %i need at least 8GB. ' % mem 57 msg += 'Skipping Patong beach validation' 58 raise Exception(msg) 25 59 26 60 #print … … 28 62 #print s 29 63 res = os.system('python %s > test_patong_scenario.stdout' % s) 30 assert res == 064 #assert res == 0 31 65 32 66
Note: See TracChangeset
for help on using the changeset viewer.