#4430 Implement GetDaysSinceStart and add way of connecting to existing ResInsight in pytest

This commit is contained in:
Gaute Lindkvist
2019-06-06 09:12:44 +02:00
parent 05451aa904
commit 4701ea5134
4 changed files with 49 additions and 10 deletions

View File

@@ -8,10 +8,6 @@ import rips
_rips_instance = None
if not os.environ.get("RESINSIGHT_EXECUTABLE"):
print("ERROR: Need to have the environment variable RESINSIGHT_EXECUTABLE set to a valid ResInsight executable")
exit(1)
@pytest.fixture
def rips_instance():
return _rips_instance
@@ -22,12 +18,18 @@ def initializeTest():
def pytest_addoption(parser):
parser.addoption("--console", action="store_true", default=False, help="Run as console application")
parser.addoption("--existing", action="store_true", default=False, help="Look for existing ResInsight")
def pytest_configure(config):
global _rips_instance
console = False
if config.getoption('--console'):
if config.getoption('--existing'):
print("Looking for existing ResInsight")
_rips_instance = rips.Instance.find()
elif config.getoption('--console'):
print("Should run as console app")
console = True
_rips_instance = rips.Instance.launch(console=console)
assert(_rips_instance is not None)
_rips_instance = rips.Instance.launch(console=console)
if not _rips_instance:
print("Need a valid ResInsight executable to launch tests")
exit(0)