Skip to content

Commit a23d93e

Browse files
committed
[OMCPath] add pytest (only docker at the moment)
1 parent 3a3c9a5 commit a23d93e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_OMCPath.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import OMPython
2+
3+
4+
def test_OMCPath_docker():
5+
omcp = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal")
6+
om = OMPython.OMCSessionZMQ(omc_process=omcp)
7+
assert om.sendExpression("getVersion()") == "OpenModelica 1.25.0"
8+
9+
p1 = om.omcpath('/tmp')
10+
assert str(p1) == "/tmp"
11+
p2 = p1 / 'test.txt'
12+
assert str(p2) == "/tmp/test.txt"
13+
assert p2.write_text('test')
14+
assert p2.read_text() == "test"
15+
assert p2.is_file()
16+
assert p2.parent.is_dir()
17+
assert p2.unlink()
18+
assert p2.is_file() == False
19+
20+
del omcp
21+
del om
22+
23+
24+
if __name__ == '__main__':
25+
test_OMCPath_docker()
26+
print('DONE')

0 commit comments

Comments
 (0)