mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* #12044 Python: Add Non-Darcy properties available in Python * #12049 Python: Add checking for multiple consecutive upper case letters The scripting keyword is transformed to snake_case for use in Python. When data in Python is sent back to ResInsight, the opposite operation happens. This concept works well for most variants of keywords, but there are some corner cases that is not working. Add compile time checking to make sure that the scripting keywords are formatted correctly. Fix keyword that has been formatted the wrong way and has never worked. * Avoid running test if ResInsight executable path is not defined in env * Make sure dash is allowed in enumeration text string
65 lines
1.7 KiB
Python
65 lines
1.7 KiB
Python
import sys
|
|
import os
|
|
import math
|
|
import pytest
|
|
import grpc
|
|
import tempfile
|
|
import time
|
|
import multiprocessing
|
|
|
|
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
|
|
import rips
|
|
|
|
import dataroot
|
|
|
|
|
|
def launch_resinsight(sec=1):
|
|
resinsight_executable_from_env = os.environ.get("RESINSIGHT_EXECUTABLE")
|
|
if resinsight_executable_from_env is None:
|
|
print("RESINSIGHT_EXECUTABLE environment variable is not set")
|
|
return
|
|
instance = rips.Instance.launch(console=True, launch_port=0)
|
|
print(instance.location)
|
|
|
|
print(f"Sleeping for {sec} second(s): ", instance.location)
|
|
time.sleep(sec)
|
|
print(f"Done sleeping", instance.location)
|
|
|
|
instance.exit()
|
|
|
|
|
|
def test_launch_sequential(rips_instance, initialize_test):
|
|
resinsight_executable_from_env = os.environ.get("RESINSIGHT_EXECUTABLE")
|
|
if resinsight_executable_from_env is None:
|
|
print("RESINSIGHT_EXECUTABLE environment variable is not set")
|
|
return
|
|
instance_list = []
|
|
for i in range(4):
|
|
rips_instance = rips.Instance.launch(console=True)
|
|
instance_list.append(rips_instance)
|
|
|
|
for instance in instance_list:
|
|
print(instance)
|
|
instance.exit()
|
|
|
|
|
|
def test_launch_parallell(rips_instance, initialize_test):
|
|
resinsight_executable_from_env = os.environ.get("RESINSIGHT_EXECUTABLE")
|
|
if resinsight_executable_from_env is None:
|
|
print("RESINSIGHT_EXECUTABLE environment variable is not set")
|
|
return
|
|
|
|
process_list = []
|
|
|
|
instance_count = 10
|
|
for i in range(instance_count):
|
|
process = multiprocessing.Process(target=launch_resinsight)
|
|
process_list.append(process)
|
|
|
|
for process in process_list:
|
|
process.start()
|
|
|
|
# completing process
|
|
for p in process_list:
|
|
p.join()
|