Skip to content

Commit 2758460

Browse files
committed
[ModelicaSystemDoE] fix unittest
* test_ModelicaSystemDoE_local is tested * test_ModelicaSystemDoE_docker should work * test_ModelicaSystemDoE_WSL is untested
1 parent c40aeb9 commit 2758460

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

tests/test_ModelicaSystemDoE.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ def test_ModelicaSystemDoE_local(tmp_path, model_doe, param_doe):
5555
tmpdir = tmp_path / 'DoE'
5656
tmpdir.mkdir(exist_ok=True)
5757

58-
doe_mod = OMPython.ModelicaSystemDoE(
58+
mod = OMPython.ModelicaSystem()
59+
mod.model(
5960
model_file=model_doe,
6061
model_name="M",
62+
)
63+
64+
doe_mod = OMPython.ModelicaSystemDoE(
65+
mod=mod,
6166
parameters=param_doe,
6267
resultpath=tmpdir,
63-
simargs={"override": {'stopTime': 1.0}},
68+
simargs={"override": {'stopTime': '1.0'}},
6469
)
6570

6671
_run_ModelicaSystemDoe(doe_mod=doe_mod)
@@ -72,12 +77,18 @@ def test_ModelicaSystemDoE_docker(tmp_path, model_doe, param_doe):
7277
omcs = OMPython.OMCSessionDocker(docker="openmodelica/openmodelica:v1.25.0-minimal")
7378
assert omcs.sendExpression("getVersion()") == "OpenModelica 1.25.0"
7479

75-
doe_mod = OMPython.ModelicaSystemDoE(
80+
mod = OMPython.ModelicaSystem(
81+
session=omcs,
82+
)
83+
mod.model(
7684
model_file=model_doe,
7785
model_name="M",
86+
)
87+
88+
doe_mod = OMPython.ModelicaSystemDoE(
89+
mod=mod,
7890
parameters=param_doe,
79-
session=omcs,
80-
simargs={"override": {'stopTime': 1.0}},
91+
simargs={"override": {'stopTime': '1.0'}},
8192
)
8293

8394
_run_ModelicaSystemDoe(doe_mod=doe_mod)
@@ -86,15 +97,21 @@ def test_ModelicaSystemDoE_docker(tmp_path, model_doe, param_doe):
8697
@pytest.mark.skip(reason="Not able to run WSL on github")
8798
@skip_python_older_312
8899
def test_ModelicaSystemDoE_WSL(tmp_path, model_doe, param_doe):
89-
tmpdir = tmp_path / 'DoE'
90-
tmpdir.mkdir(exist_ok=True)
100+
omcs = OMPython.OMCSessionWSL()
101+
assert omcs.sendExpression("getVersion()") == "OpenModelica 1.25.0"
91102

92-
doe_mod = OMPython.ModelicaSystemDoE(
103+
mod = OMPython.ModelicaSystem(
104+
session=omcs,
105+
)
106+
mod.model(
93107
model_file=model_doe,
94108
model_name="M",
109+
)
110+
111+
doe_mod = OMPython.ModelicaSystemDoE(
112+
mod=mod,
95113
parameters=param_doe,
96-
resultpath=tmpdir,
97-
simargs={"override": {'stopTime': 1.0}},
114+
simargs={"override": {'stopTime': '1.0'}},
98115
)
99116

100117
_run_ModelicaSystemDoe(doe_mod=doe_mod)

0 commit comments

Comments
 (0)