Exemplo n.º 1
0
 def _create_test(self, parameter_file_name):
     with open(parameter_file_name + '_parameters.json',
               'r') as parameter_file:
         project_parameters = Parameters(parameter_file.read())
         parameter_file.close()
     test = test_MainKratos.MainKratos(project_parameters)
     return test
Exemplo n.º 2
0
 def test_Execution(self):
     with ControlledExecutionScope(os.path.dirname(os.path.realpath(__file__))):
         # run simulation and write to hdf5 file
         parameter_file = open("test_input_output/output_test_parameters.json", 'r')
         project_parameters = Parameters(parameter_file.read())
         parameter_file.close()
         test = test_MainKratos.MainKratos(project_parameters)
         test.Solve()
         # start new simulation and read from hdf5 file
         parameter_file = open("test_input_output/input_test_parameters.json", 'r')
         project_parameters = Parameters(parameter_file.read())
         parameter_file.close()
         test = test_MainKratos.MainKratos(project_parameters)
         test.Solve()
         # remove hdf5 file
         if "io_test_0.h5" in os.listdir("./test_input_output"):
             os.remove("./test_input_output/io_test_0.h5")
         # remove other generated files
         if "io_test.time" in os.listdir("./test_input_output"):
             os.remove("./test_input_output/io_test.time")
         if "reference_results.json" in os.listdir("./test_input_output"):
             os.remove("./test_input_output/reference_results.json")