Skip to content

Commit 6d85271

Browse files
committed
Update tests
1 parent bf0262b commit 6d85271

5 files changed

Lines changed: 7 additions & 28 deletions

File tree

OMPython/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class which means it will use OMCSessionZMQ by default. If you want to use
4444
import platform
4545
import psutil
4646
import re
47+
import shlex
4748
import signal
4849
import subprocess
4950
import sys

tests/test_ArrayDimension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Test_ArrayDimension:
1111

1212
def test_ArrayDimension(self):
13-
omc = OMPython.OMCSessionZMQ()
13+
omc = OMPython.OMCSession()
1414

1515
## create a temp dir for each session
1616
tempdir = tempfile.mkdtemp()

tests/test_FMIRegression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Test_FMIRegression:
1111

1212
def buildModelFMU(self, modelName):
13-
omc = OMPython.OMCSessionZMQ()
13+
omc = OMPython.OMCSession()
1414

1515
## create a temp dir for each session
1616
tempdir = tempfile.mkdtemp()

tests/test_ZMQ.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, *args, **kwargs):
1111
self.tmp = tempfile.mkdtemp(prefix='tmpOMPython.tests')
1212
self.origDir = os.getcwd()
1313
os.chdir(self.tmp)
14-
self.om = OMPython.OMCSessionZMQ()
14+
self.om = OMPython.OMCSession()
1515
os.chdir(self.origDir)
1616
def __del__(self):
1717
shutil.rmtree(self.tmp, ignore_errors=True)
@@ -33,27 +33,5 @@ def testSimulate(self):
3333
self.assertNotEqual("", self.om.sendExpression('res.resultFile'))
3434
self.clean()
3535

36-
class FindBestOMCSession(unittest.TestCase):
37-
def __init__(self, *args, **kwargs):
38-
super(FindBestOMCSession, self).__init__(*args, **kwargs)
39-
self.simpleModel = """model M
40-
Real r = time;
41-
end M;"""
42-
self.tmp = tempfile.mkdtemp(prefix='tmpOMPython.extratests')
43-
self.origDir = os.getcwd()
44-
os.chdir(self.tmp)
45-
self.om = OMPython.FindBestOMCSession()
46-
os.chdir(self.origDir)
47-
def __del__(self):
48-
shutil.rmtree(self.tmp, ignore_errors=True)
49-
del(self.om)
50-
def clean(self):
51-
del(self.om)
52-
self.om = None
53-
54-
def testHelloWorldBestOMCSession(self):
55-
self.assertEqual("HelloWorld!", self.om.sendExpression('"HelloWorld!"'))
56-
self.clean()
57-
5836
if __name__ == '__main__':
5937
unittest.main()

tests/test_docker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
class DockerTester(unittest.TestCase):
77
@pytest.mark.skip(reason="This test would fail")
88
def testDocker(self):
9-
om = OMPython.OMCSessionZMQ(docker="openmodelica/openmodelica:v1.16.1-minimal")
9+
om = OMPython.OMCSession(docker="openmodelica/openmodelica:v1.16.1-minimal")
1010
assert(om.sendExpression("getVersion()") == "OpenModelica 1.16.1")
11-
omInner = OMPython.OMCSessionZMQ(dockerContainer=om._dockerCid)
11+
omInner = OMPython.OMCSession(dockerContainer=om._dockerCid)
1212
assert(omInner.sendExpression("getVersion()") == "OpenModelica 1.16.1")
13-
om2 = OMPython.OMCSessionZMQ(docker="openmodelica/openmodelica:v1.16.1-minimal", port=11111)
13+
om2 = OMPython.OMCSession(docker="openmodelica/openmodelica:v1.16.1-minimal", port=11111)
1414
assert(om2.sendExpression("getVersion()") == "OpenModelica 1.16.1")
1515
del(om2)
1616
del(omInner)

0 commit comments

Comments
 (0)