Changeset 6782


Ignore:
Timestamp:
Apr 14, 2009, 9:55:53 AM (16 years ago)
Author:
rwilson
Message:

Modified to run correctly in remote user environment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/automated_validation_tests/patong_validation/validate_patong.py

    r6665 r6782  
    1313import shutil
    1414
    15 import project
    1615from anuga.utilities.system_tools import get_web_file, untar_file
    1716import anuga.utilities.log as log
     
    4645    Check we have required data set in project.py.
    4746    '''
    48    
    49     # Check that environment variables are defined.
    50     if os.getenv(project.ENV_INUNDATIONHOME) is None:
    51         msg = ("Environment variable '%s' is not set in project.py"
    52                % project.ENV_INUNDATIONHOME)
    53         raise Exception, msg
    54 
    55     if os.getenv(project.ENV_MUXHOME) is None:
    56         msg = ("Environment variable '%s' is not set in project.py"
    57                % project.ENV_MUXHOME)
    58         raise Exception, msg
     47   
     48    pass
    5949
    6050
     
    147137   
    148138    # modify environment so we use the local data
    149     # INUNDATIONHOME points into the 'data' local data directory
    150     old_inundationhome = os.getenv(project.ENV_INUNDATIONHOME)
    151     os.putenv(project.ENV_INUNDATIONHOME,
    152               os.path.join(Local_Data_Directory, ''))
    153     old_muxhome = os.getenv(project.ENV_MUXHOME)
    154     os.putenv(project.ENV_MUXHOME,
    155               os.path.join(Local_Data_Directory, 'data'))
    156    
     139    new_inundationhome = os.path.join(Local_Data_Directory, '')
     140    os.environ['INUNDATIONHOME'] = new_inundationhome
     141    new_muxhome = os.path.join(Local_Data_Directory, 'data')
     142    os.environ['MUXHOME'] = new_muxhome
     143
     144    # We import here, _after_ environment variables are set
     145    import project
     146
    157147    # run the simulation, produce SWW file
    158148    log.debug('Running Patong simulation ...')
     
    161151    assert res == 0
    162152
    163     # undo environment changes
    164     if old_inundationhome:
    165         os.putenv(project.ENV_INUNDATIONHOME, old_inundationhome)
    166     if old_muxhome:
    167         os.putenv(project.ENV_MUXHOME, old_muxhome)
    168 
    169    
    170153def check_that_output_is_as_expected():
    171154    '''Check that validation output is as required.'''
Note: See TracChangeset for help on using the changeset viewer.