Skip to content

Commit 0d87d2c

Browse files
committed
Fixing testmodel.py
1 parent 416d094 commit 0d87d2c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

conversionscript.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
from OMPython import OMCSessionZMQ, pyparsing
4+
from OMPython import OMCSessionZMQ
5+
import pyparsing
56
import argparse
67
import glob
78
import json
@@ -32,12 +33,12 @@
3233
os.mkdir("converted-libraries/.openmodelica")
3334
os.mkdir("converted-libraries/.openmodelica/libraries")
3435

35-
def omcAssert(omc, cmd, extra=""):
36+
def omcAssert(omc: OMCSessionZMQ, cmd: str, extra: str = ""):
3637
res = omc.sendExpression(cmd)
3738
if not res:
3839
raise Exception(cmd + "\n" + extra + "\n" + (omc.sendExpression("getErrorString()") or ""))
3940

40-
def omcSendExpression(omc, cmd, extra=""):
41+
def omcSendExpression(omc: OMCSessionZMQ, cmd: str, extra: str = ""):
4142
try:
4243
return omc.sendExpression(cmd)
4344
except pyparsing.ParseException as e:

testmodel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from asyncio.subprocess import STDOUT
66
import simplejson as json
77
from monotonic import monotonic
8-
from OMPython import OMCSession, OMCSessionZMQ
8+
from OMPython import OMCSessionZMQ, OMCProcessDocker
99
import shared, glob
1010

1111
parser = argparse.ArgumentParser(description='OpenModelica library testing tool helper (single model)')
@@ -251,7 +251,11 @@ def target(res):
251251
os.environ["OPENMODELICAHOME"] = omhome
252252

253253
def createOmcSession():
254-
return OMCSession(docker=docker, dockerExtraArgs=dockerExtraArgs, timeout=5) if corbaStyle else OMCSessionZMQ(docker=docker, dockerExtraArgs=dockerExtraArgs, timeout=5)
254+
if docker:
255+
return OMCProcessDocker(docker=docker, dockerExtraArgs=dockerExtraArgs, timeout=5)
256+
else:
257+
return OMCSessionZMQ(timeout=5)
258+
255259
def createOmcSessionNew():
256260
if ompython_omhome != "":
257261
os.environ["OPENMODELICAHOME"] = ompython_omhome

0 commit comments

Comments
 (0)