def verify_json_dump(self, selected_jobs, global_args, umask, run_id):
        self.assertTrue(os.path.isfile(self.JOBS_JSON_FILE))
        config = load_configs(self.JOBS_JSON_FILE)

        self.assertEqual(run_id, config["run_id"])
        self.assertEqual(umask, int(config["umask"], 8))
        self.assertEqual(len(selected_jobs), len(config["jobList"]))

        ert_version = config["ert_version"]
        loaded_version = Version(ert_version[0], ert_version[1],
                                 ert_version[2])
        self.assertEqual(Version.currentVersion(), loaded_version)

        for i in range(len(selected_jobs)):
            job = joblist[selected_jobs[i]]
            loaded_job = config["jobList"][i]

            # Since no argList is loaded as an empty list by ext_job
            arg_list_back_up = job["argList"]
            job["argList"] = empty_list_if_none(job["argList"])

            # Since name is set to default if none provided by ext_job
            name_back_up = job["name"]
            job["name"] = default_name_if_none(job["name"])

            for key in json_keywords:
                self.assertEqual(job[key], loaded_job[key])

            job["argList"] = arg_list_back_up
            job["name"] = name_back_up
Example #2
0
File: ertplot.py Project: pgdr/ert
def main(argv):

    app = QApplication(argv) #Early so that QT is initialized before other imports
    app.setWindowIcon(resourceIcon("application/window_icon_cutout"))

    if len(argv) == 1:
        sys.stderr.write("Missing configuration file")
        sys.exit(1)

    config_file = argv[1]
    strict = True
        
    if not os.path.exists(config_file):
        print("Can not run without a configuration file.")
        sys.exit(1)

    if os.path.isdir(config_file):
        print("The specified configuration file is a directory!")
        sys.exit(1)


    splash = ErtSplash()
    splash.version = "Version %s" % Version.getVersion()
    splash.timestamp = Version.getBuildTime()

    splash.show()
    splash.repaint()

    now = time.time()

    res_config = ResConfig(config_file)
    ert = EnKFMain(res_config, strict=strict, verbose=False)
    ert_gui.configureErtNotifier(ert, config_file)

    window = PlotWindow(ert, None)

    sleep_time = 2 - (time.time() - now)

    if sleep_time > 0:
        time.sleep(sleep_time)

    window.show()
    splash.finish(window)
    window.activateWindow()
    window.raise_()
    finished_code = app.exec_()

    ert.free()

    sys.exit(finished_code)
Example #3
0
File: ertplot.py Project: pgdr/ert
def main(argv):

    app = QApplication(
        argv)  #Early so that QT is initialized before other imports
    app.setWindowIcon(resourceIcon("application/window_icon_cutout"))

    if len(argv) == 1:
        sys.stderr.write("Missing configuration file")
        sys.exit(1)

    config_file = argv[1]
    strict = True

    if not os.path.exists(config_file):
        print("Can not run without a configuration file.")
        sys.exit(1)

    if os.path.isdir(config_file):
        print("The specified configuration file is a directory!")
        sys.exit(1)

    splash = ErtSplash()
    splash.version = "Version %s" % Version.getVersion()
    splash.timestamp = Version.getBuildTime()

    splash.show()
    splash.repaint()

    now = time.time()

    res_config = ResConfig(config_file)
    ert = EnKFMain(res_config, strict=strict, verbose=False)
    ert_gui.configureErtNotifier(ert, config_file)

    window = PlotWindow(ert, None)

    sleep_time = 2 - (time.time() - now)

    if sleep_time > 0:
        time.sleep(sleep_time)

    window.show()
    splash.finish(window)
    window.activateWindow()
    window.raise_()
    finished_code = app.exec_()

    ert.free()

    sys.exit(finished_code)
Example #4
0
    def test_create(self):
        v1 = Version(1, 8, 6)
        self.assertFalse(v1.isDevelVersion())

        self.assertEqual(v1.versionString(), "1.8.6")
        self.assertEqual(v1.versionTuple(), (1, 8, 6))

        v2 = Version(2, 0, "X")
        self.assertTrue(v2.isDevelVersion())
Example #5
0
    def test_import(self):
        from ecl import Version as globalVersion
        v1 = globalVersion(1, 1, 2)
        v2 = Version(1, 1, 2)

        self.assertTrue(v1 == v2)
        self.assertEqual(v1, v2)
        self.assertEqual(repr(v1), repr(v2))
Example #6
0
    def createInfoLayout():
        info_layout = QVBoxLayout()

        ert = QLabel()
        ert.setAlignment(Qt.AlignHCenter)

        title_font = QFont()
        title_font.setPointSize(40)
        ert.setFont(title_font)
        ert.setText("ERT")

        info_layout.addWidget(ert)
        info_layout.addStretch(1)
        ert_title = QLabel()
        ert_title.setAlignment(Qt.AlignHCenter)
        ert_title.setText("Ensemble based Reservoir Tool")
        info_layout.addWidget(ert_title)

        version = QLabel()
        version.setAlignment(Qt.AlignHCenter)
        version.setText("Version: %s" % Version.getVersion())
        info_layout.addWidget(version)

        timestamp = QLabel()
        timestamp.setAlignment(Qt.AlignHCenter)
        timestamp.setText("Build time: %s" % Version.getBuildTime())
        info_layout.addWidget(timestamp)

        git_commit = QLabel()
        git_commit.setAlignment(Qt.AlignHCenter)
        git_commit.setText("Git commit hash: %s" %
                           Version.getGitCommit(short=True))
        info_layout.addWidget(git_commit)

        info_layout.addStretch(5)

        return info_layout
Example #7
0
 def test_current(self):
     current = Version.currentVersion()
     self.assertTrue(current > (0, 0, 0))
     pfx = 'Version(major='
     self.assertEqual(pfx, repr(current)[:len(pfx)])
Example #8
0
 def test_root_version(self):
     cv = Version.currentVersion()
     self.assertEqual(ecl.__version__, cv.versionString())