Use try: except: to import test utility code
This commit is contained in:
@@ -3,7 +3,10 @@ import unittest
|
|||||||
from opm.io.parser import Parser
|
from opm.io.parser import Parser
|
||||||
from opm.io.ecl_state import EclipseState
|
from opm.io.ecl_state import EclipseState
|
||||||
from opm.io.schedule import Schedule
|
from opm.io.schedule import Schedule
|
||||||
from utils import test_path
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
def flowing(connection):
|
def flowing(connection):
|
||||||
return connection.state == 'OPEN'
|
return connection.state == 'OPEN'
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import sys
|
|||||||
|
|
||||||
from opm.io.parser import Parser, ParseContext
|
from opm.io.parser import Parser, ParseContext
|
||||||
from opm.io.ecl_state import EclipseState
|
from opm.io.ecl_state import EclipseState
|
||||||
from utils import test_path
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
class TestParse(unittest.TestCase):
|
class TestParse(unittest.TestCase):
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import numpy as np
|
|||||||
from opm.io.parser import Parser
|
from opm.io.parser import Parser
|
||||||
from opm.io.parser import ParseContext
|
from opm.io.parser import ParseContext
|
||||||
from opm.io.deck import DeckKeyword
|
from opm.io.deck import DeckKeyword
|
||||||
from utils import test_path
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
|
|
||||||
unit_foot = 0.3048 #meters
|
unit_foot = 0.3048 #meters
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ import opm.io
|
|||||||
|
|
||||||
from opm.io.parser import Parser
|
from opm.io.parser import Parser
|
||||||
from opm.io.ecl_state import EclipseState
|
from opm.io.ecl_state import EclipseState
|
||||||
from utils import test_path
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
|
|
||||||
class TestProps(unittest.TestCase):
|
class TestProps(unittest.TestCase):
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import datetime as dt
|
|||||||
from opm.io.parser import Parser
|
from opm.io.parser import Parser
|
||||||
from opm.io.ecl_state import EclipseState
|
from opm.io.ecl_state import EclipseState
|
||||||
from opm.io.schedule import Schedule
|
from opm.io.schedule import Schedule
|
||||||
from utils import test_path
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
class TestSchedule(unittest.TestCase):
|
class TestSchedule(unittest.TestCase):
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ from opm.io.parser import Parser
|
|||||||
from opm.io.ecl_state import EclipseState
|
from opm.io.ecl_state import EclipseState
|
||||||
from opm.io.schedule import Schedule
|
from opm.io.schedule import Schedule
|
||||||
from opm.io.summary import SummaryConfig
|
from opm.io.summary import SummaryConfig
|
||||||
from utils import test_path
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
class TestState2(unittest.TestCase):
|
class TestState2(unittest.TestCase):
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ SATNUM
|
|||||||
# jf["GAS_OIL"] = -1.0 # N/A
|
# jf["GAS_OIL"] = -1.0 # N/A
|
||||||
|
|
||||||
parser = Parser()
|
parser = Parser()
|
||||||
deck = parser.parse('tests/data/JFUNC.DATA')
|
deck = parser.parse(test_path('data/JFUNC.DATA'))
|
||||||
js = EclipseState(deck)
|
js = EclipseState(deck)
|
||||||
self.assertEqual('JFUNC TEST', js.title)
|
self.assertEqual('JFUNC TEST', js.title)
|
||||||
jf = js.jfunc()
|
jf = js.jfunc()
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ import datetime
|
|||||||
from opm.tools import *
|
from opm.tools import *
|
||||||
|
|
||||||
from opm.io.parser import Parser
|
from opm.io.parser import Parser
|
||||||
from utils import test_path, tmp
|
try:
|
||||||
|
from tests.utils import test_path, tmp
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path, tmp
|
||||||
|
|
||||||
class TestTimeVector(unittest.TestCase):
|
class TestTimeVector(unittest.TestCase):
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import opm
|
|||||||
from opm.io.parser import Parser
|
from opm.io.parser import Parser
|
||||||
from opm.io.ecl_state import EclipseState
|
from opm.io.ecl_state import EclipseState
|
||||||
from opm.io.schedule import Schedule
|
from opm.io.schedule import Schedule
|
||||||
from utils import test_path
|
|
||||||
|
try:
|
||||||
|
from tests.utils import test_path
|
||||||
|
except ImportError:
|
||||||
|
from utils import test_path
|
||||||
|
|
||||||
def injector(well):
|
def injector(well):
|
||||||
return well.isinjector()
|
return well.isinjector()
|
||||||
|
|||||||
Reference in New Issue
Block a user