Skip to content

Commit 9240ff6

Browse files
committed
[test_OMCPath] define test using OMCSessionZMQ() locally
1 parent 70a9c65 commit 9240ff6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_OMCPath.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import OMPython
2+
import pytest
23

34

5+
@pytest.mark.skip(reason="This test would fail (no docker on github)")
46
def test_OMCPath_docker():
57
omcp = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal")
68
om = OMPython.OMCSessionZMQ(omc_process=omcp)
@@ -21,6 +23,23 @@ def test_OMCPath_docker():
2123
del om
2224

2325

26+
def test_OMCPath_local():
27+
om = OMPython.OMCSessionZMQ()
28+
29+
p1 = om.omcpath('/tmp')
30+
assert str(p1) == "/tmp"
31+
p2 = p1 / 'test.txt'
32+
assert str(p2) == "/tmp/test.txt"
33+
assert p2.write_text('test')
34+
assert p2.read_text() == "test"
35+
assert p2.is_file()
36+
assert p2.parent.is_dir()
37+
assert p2.unlink()
38+
assert p2.is_file() is False
39+
40+
del om
41+
42+
2443
if __name__ == '__main__':
2544
test_OMCPath_docker()
2645
print('DONE')

0 commit comments

Comments
 (0)