Пример #1
0
    def test_error_parse(self):
        with TestAreaContext("ecl_run") as ta:
            self.init_config()
            ta.copy_file( os.path.join(self.SOURCE_ROOT , "test-data/local/eclipse/SPE1.ERROR.DATA"))
            ta.copy_file( os.path.join(self.SOURCE_ROOT , "test-data/local/eclipse/SPE1.DATA"))

            argv = ["run_ecl100" , "2014.2" , "SPE1.DATA"]
            ecl_run = EclRun(argv)
            ecl_run.runEclipse( )

            prt_file = os.path.join(self.SOURCE_ROOT , "test-data/local/eclipse/parse/ERROR.PRT")
            shutil.copy(prt_file , "SPE1.PRT")

            error_list = ecl_run.parseErrors( )
            self.assertEqual( len(error_list) , 2 )


            # NB: The ugly white space in the error0 literal is actually part of
            #     the string we are matching; i.e. it must be retained.
            error0 = """ @--  ERROR  AT TIME        0.0   DAYS    ( 1-JAN-0):
 @           UNABLE TO OPEN INCLUDED FILE                                    
 @           /private/joaho/ERT/git/Gurbat/XXexample_grid_sim.GRDECL         
 @           SYSTEM ERROR CODE IS       29                                   """

            error1 = """ @--  ERROR  AT TIME        0.0   DAYS    ( 1-JAN-0):
 @           INCLUDE FILES MISSING.                                          """
            
            self.assertEqual( error_list[0] , error0 )
            self.assertEqual( error_list[1] , error1 )
Пример #2
0
    def test_run(self):
        self.init_eclrun_config()
        shutil.copy(
            os.path.join(self.SOURCE_ROOT, "test-data/local/eclipse/SPE1.DATA"),
            "SPE1.DATA",
        )
        ecl_config = Ecl100Config()

        ecl_run = EclRun("SPE1.DATA", None)
        ecl_run.runEclipse(eclrun_config=EclrunConfig(ecl_config, "2019.3"))

        ok_path = os.path.join(ecl_run.runPath(), "{}.OK".format(ecl_run.baseName()))
        log_path = os.path.join(ecl_run.runPath(), "{}.LOG".format(ecl_run.baseName()))

        self.assertTrue(os.path.isfile(ok_path))
        self.assertTrue(os.path.isfile(log_path))
        self.assertTrue(os.path.getsize(log_path) > 0)

        errors = ecl_run.parseErrors()
        self.assertEqual(0, len(errors))
Пример #3
0
    def test_run(self):
        with TestAreaContext("ecl_run") as ta:
            self.init_config()
            ta.copy_file( os.path.join(self.SOURCE_ROOT , "test-data/local/eclipse/SPE1.DATA"))
            os.makedirs("ecl_run")
            shutil.move("SPE1.DATA" , "ecl_run")
            argv = ["run_ecl100" , "2014.2" , "ecl_run/SPE1.DATA"]
            ecl_run = EclRun(argv)
            ecl_run.runEclipse( )

            self.assertTrue( os.path.isfile( os.path.join( ecl_run.runPath() , "%s.stderr" % ecl_run.baseName())))
            self.assertTrue( os.path.isfile( os.path.join( ecl_run.runPath() , "%s.LOG" % ecl_run.baseName())))
            self.assertTrue( os.path.isfile( os.path.join( ecl_run.runPath() , "%s.OK" % ecl_run.baseName())))

            errors = ecl_run.parseErrors( )
            self.assertEqual( 0 , len(errors ))

            # Monkey patching the ecl_run to use an executable which
            # will fail with exit(1); don't think Eclipse actually
            # fails with exit(1) - but let us at least be prepared
            # when/if it does.
            ecl_run.sim.executable = os.path.join( self.SOURCE_ROOT , "tests/classes/ecl_run_fail")
            with self.assertRaises(Exception):
                ecl_run.runEclipse( )