22import OMPython
33import pathlib
44import 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