Skip to content

Commit 4b496f4

Browse files
committed
[test_OMCPath] update & extend test
1 parent 59366a0 commit 4b496f4

1 file changed

Lines changed: 27 additions & 15 deletions

File tree

tests/test_OMCPath.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@skip_on_windows
1717
@skip_python_older_312
18-
def test_OMCPath_docker():
18+
def test_OMCPath_OMCProcessDocker():
1919
omcp = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal")
2020
om = OMPython.OMCSessionZMQ(omc_process=omcp)
2121
assert om.sendExpression("getVersion()") == "OpenModelica 1.25.0"
@@ -26,17 +26,25 @@ def test_OMCPath_docker():
2626
del om
2727

2828

29-
@skip_python_older_312
30-
def test_OMCPath_local():
29+
def test_OMCPath_OMCSessionZMQ():
3130
om = OMPython.OMCSessionZMQ()
3231

3332
_run_OMCPath_checks(om)
3433

3534
del om
3635

3736

37+
def test_OMCPath_OMCProcessLocal():
38+
omp = OMPython.OMCProcessLocal()
39+
om = OMPython.OMCSessionZMQ(omc_process=omp)
40+
41+
_run_OMCPath_checks(om)
42+
43+
del om
44+
45+
3846
@pytest.mark.skip(reason="Not able to run WSL on github")
39-
def test_OMCPath_WSL():
47+
def test_OMCPath_OMCProcessWSL():
4048
omcp = OMPython.OMCProcessWSL(
4149
wsl_omc='omc',
4250
wsl_user='omc',
@@ -52,14 +60,18 @@ def test_OMCPath_WSL():
5260

5361
def _run_OMCPath_checks(om: OMPython.OMCSessionZMQ):
5462
p1 = om.omcpath_tempdir()
55-
p2 = p1 / '..' / p1.name / 'test.txt'
56-
assert p2.is_file() is False
57-
assert p2.write_text('test')
58-
assert p2.is_file()
59-
p2 = p2.resolve().absolute()
60-
assert str(p2) == f"{str(p1)}/test.txt"
61-
assert p2.read_text() == "test"
62-
assert p2.is_file()
63-
assert p2.parent.is_dir()
64-
assert p2.unlink()
65-
assert p2.is_file() is False
63+
p2 = p1 / 'test'
64+
p2.mkdir()
65+
assert p2.is_dir()
66+
p3 = p2 / '..' / p2.name / 'test.txt'
67+
assert p3.is_file() is False
68+
assert p3.write_text('test')
69+
assert p3.is_file()
70+
assert p3.size() > 0
71+
p3 = p3.resolve().absolute()
72+
assert str(p3) == f"{str(p2)}/test.txt"
73+
assert p3.read_text() == "test"
74+
assert p3.is_file()
75+
assert p3.parent.is_dir()
76+
assert p3.unlink()
77+
assert p3.is_file() is False

0 commit comments

Comments
 (0)