def test_run_model(self): r""" Testing the method used to run a single instance of the model. This also hits the InputFile class pretty heavy """ inp_file = RunModel.InputFile(os.path.join(FIXTURE_DIR, 'TEST_INIT.INP')) # # updating paths so they are absolute files = ['SUMMARY-FILE', 'STAT-FILE', 'APER-FILE', 'FLOW-FILE', 'PRESS-FILE', 'VTK-FILE'] for file in files: inp_file[file].update_value(os.path.join(TEMP_DIR, file+'.RCTEST')) inp_file.filename_formats['input_file'] = os.path.join(TEMP_DIR, 'TEST_INIT.INP') # dirs = os.path.split(inp_file['PVT-FILE'].value) new_path = os.path.join(FIXTURE_DIR, 'PVT', 'H2O_TEMP_058F.CSV') inp_file['PVT-FILE'].update_value(new_path) # dirs = os.path.split(inp_file['APER-MAP'].value) new_path = os.path.join(FIXTURE_DIR, 'TEST-FRACTURES', 'parallel-plate-01vox.txt') inp_file['APER-MAP'].update_value(new_path) # inp_file.outfile_name = os.path.join(TEMP_DIR, 'TEST-INIT-run-model.INP') exe_path = os.path.realpath(os.path.join('.', inp_file['EXE-FILE'].value)) inp_file['EXE-FILE'].update_value(exe_path, False) # # running the model both async and in sync proc = RunModel.run_model(inp_file, synchronous=False) assert proc.poll() is None # proc = RunModel.run_model(inp_file, synchronous=True, show_stdout=True) assert proc.poll() == 0
def test_estimate_req_RAM(self): r""" Ensuring RAM req is being calculated """ map_file = os.path.join(FIXTURE_DIR, 'TEST-FRACTURES', 'parallel-plate-01vox.txt') RunModel.estimate_req_RAM([map_file], 10) with pytest.raises(EnvironmentError): RunModel.estimate_req_RAM([map_file], 0)