forked from OpenModelica/OMPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_docker.py
More file actions
32 lines (24 loc) · 989 Bytes
/
test_docker.py
File metadata and controls
32 lines (24 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
import pytest
import OMPython
skip_on_windows = pytest.mark.skipif(
sys.platform.startswith("win"),
reason="OpenModelica Docker image is Linux-only; skipping on Windows.",
)
@skip_on_windows
def test_docker():
omcp = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal")
om = OMPython.OMCSessionZMQ(omc_process=omcp)
assert om.sendExpression("getVersion()") == "OpenModelica 1.25.0"
omcpInner = OMPython.OMCProcessDockerContainer(dockerContainer=omcp.get_docker_container_id())
omInner = OMPython.OMCSessionZMQ(omc_process=omcpInner)
assert omInner.sendExpression("getVersion()") == "OpenModelica 1.25.0"
omcp2 = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal", port=11111)
om2 = OMPython.OMCSessionZMQ(omc_process=omcp2)
assert om2.sendExpression("getVersion()") == "OpenModelica 1.25.0"
del omcp2
del om2
del omcpInner
del omInner
del omcp
del om