mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
36 lines
1010 B
Python
36 lines
1010 B
Python
import pytest
|
|
import sys
|
|
import os
|
|
import getopt
|
|
|
|
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
|
import rips
|
|
|
|
_rips_instance = None
|
|
|
|
@pytest.fixture
|
|
def rips_instance():
|
|
return _rips_instance
|
|
|
|
@pytest.fixture
|
|
def initializeTest():
|
|
_rips_instance.project.close()
|
|
|
|
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('--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)
|
|
if not _rips_instance:
|
|
print("Need a valid ResInsight executable to launch tests")
|
|
exit(0)
|