Skip to content

Commit dbb5de1

Browse files
committed
fix test_ModelicaSystem - needed adaptions:
* convert OMCPath to pathlib.Path * use correct exceptions
1 parent ab81257 commit dbb5de1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests_v400/test_ModelicaSystem.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_customBuildDirectory(tmp_path, model_firstorder):
105105
tmpdir = tmp_path / "tmpdir1"
106106
tmpdir.mkdir()
107107
m = OMPython.ModelicaSystem(filePath, "M", customBuildDirectory=tmpdir)
108-
assert m.getWorkDirectory().resolve() == tmpdir.resolve()
108+
assert pathlib.Path(m.getWorkDirectory().resolve()) == tmpdir.resolve()
109109
result_file = tmpdir / "a.mat"
110110
assert not result_file.exists()
111111
m.simulate(resultfile="a.mat")
@@ -311,9 +311,9 @@ def test_getters(tmp_path):
311311
mod.getOutputs("thisOutputDoesNotExist")
312312

313313
# getContinuous after simulate() should return values at end of simulation:
314-
with pytest.raises(OMPython.ModelicaSystemError):
314+
with pytest.raises(KeyError):
315315
mod.getContinuous("a") # a is a parameter
316-
with pytest.raises(OMPython.ModelicaSystemError):
316+
with pytest.raises(KeyError):
317317
mod.getContinuous(["x", "a", "y"]) # a is a parameter
318318
d = mod.getContinuous()
319319
assert d.keys() == {"x", "der(x)", "y"}
@@ -323,7 +323,7 @@ def test_getters(tmp_path):
323323
assert mod.getContinuous("x") == [d["x"]]
324324
assert mod.getContinuous(["y", "x"]) == [d["y"], d["x"]]
325325

326-
with pytest.raises(OMPython.ModelicaSystemError):
326+
with pytest.raises(KeyError):
327327
mod.getContinuous("a") # a is a parameter
328328

329329
with pytest.raises(OMPython.ModelicaSystemError):

0 commit comments

Comments
 (0)