Skip to content

Commit f2725c9

Browse files
committed
???
1 parent 259934d commit f2725c9

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

OMPython/ModelicaSystem.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,6 +1765,7 @@ def __init__(
17651765
self._simargs = simargs
17661766
self._timeout = timeout
17671767

1768+
# TODO: Update her & all path handling of this class
17681769
if isinstance(resultpath, pathlib.Path):
17691770
self._resultpath = resultpath
17701771
else:

tests/test_ModelicaSystemDoE.py

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
import OMPython
33
import pathlib
44
import pytest
5+
import sys
6+
7+
skip_on_windows = pytest.mark.skipif(
8+
sys.platform.startswith("win"),
9+
reason="OpenModelica Docker image is Linux-only; skipping on Windows.",
10+
)
11+
12+
skip_python_older_312 = pytest.mark.skipif(
13+
sys.version_info < (3, 12),
14+
reason="OMCPath(non-local) only working for Python >= 3.12.",
15+
)
516

617

718
@pytest.fixture
@@ -37,7 +48,25 @@ def param_doe() -> dict[str, list]:
3748
return param
3849

3950

40-
def test_ModelicaSystemDoE(tmp_path, model_doe, param_doe):
51+
@pytest.mark.skip(reason="No OMC")
52+
def test_ModelicaSystemDoE_local(tmp_path, model_doe, param_doe):
53+
tmpdir = tmp_path / 'DoE'
54+
tmpdir.mkdir(exist_ok=True)
55+
56+
doe_mod = OMPython.ModelicaSystemDoE(
57+
fileName=model_doe.as_posix(),
58+
modelName="M",
59+
parameters=param_doe,
60+
resultpath=tmpdir,
61+
simargs={"override": {'stopTime': 1.0}},
62+
)
63+
64+
_run_ModelicaSystemDoe(doe_mod=doe_mod)
65+
66+
67+
@skip_on_windows
68+
@skip_python_older_312
69+
def test_ModelicaSystemDoE_docker(tmp_path, model_doe, param_doe):
4170
tmpdir = tmp_path / 'DoE'
4271
tmpdir.mkdir(exist_ok=True)
4372

@@ -48,6 +77,28 @@ def test_ModelicaSystemDoE(tmp_path, model_doe, param_doe):
4877
resultpath=tmpdir,
4978
simargs={"override": {'stopTime': 1.0}},
5079
)
80+
81+
_run_ModelicaSystemDoe(doe_mod=doe_mod)
82+
83+
84+
@pytest.mark.skip(reason="Not able to run WSL on github")
85+
@skip_python_older_312
86+
def test_ModelicaSystemDoE_WSL(tmp_path, model_doe, param_doe):
87+
tmpdir = tmp_path / 'DoE'
88+
tmpdir.mkdir(exist_ok=True)
89+
90+
doe_mod = OMPython.ModelicaSystemDoE(
91+
fileName=model_doe.as_posix(),
92+
modelName="M",
93+
parameters=param_doe,
94+
resultpath=tmpdir,
95+
simargs={"override": {'stopTime': 1.0}},
96+
)
97+
98+
_run_ModelicaSystemDoe(doe_mod=doe_mod)
99+
100+
101+
def _run_ModelicaSystemDoe(doe_mod):
51102
doe_count = doe_mod.prepare()
52103
assert doe_count == 16
53104

0 commit comments

Comments
 (0)