Skip to content

Commit c8bddac

Browse files
committed
[test_OMCPath] only for Python >= 3.12
1 parent 7df431e commit c8bddac

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tests/test_OMCPath.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
reason="OpenModelica Docker image is Linux-only; skipping on Windows.",
88
)
99

10+
skip_python_older_312 = pytest.mark.skipif(
11+
sys.version_info < (3, 12),
12+
reason="OMCPath only working for Python >= 3.12 (definition of pathlib.PurePath).",
13+
)
14+
1015

1116
@skip_on_windows
17+
@skip_python_older_312
1218
def test_OMCPath_docker():
1319
omcp = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal")
1420
om = OMPython.OMCSessionZMQ(omc_process=omcp)
@@ -29,13 +35,19 @@ def test_OMCPath_docker():
2935
del om
3036

3137

38+
@skip_python_older_312
3239
def test_OMCPath_local():
3340
om = OMPython.OMCSessionZMQ()
3441

35-
p1 = om.omcpath('/tmp')
36-
assert str(p1) == "/tmp"
42+
if sys.platform.startswith("win"):
43+
tempdir = 'C:/temp'
44+
else:
45+
tempdir = '/tmp'
46+
47+
p1 = om.omcpath(tempdir)
48+
assert str(p1) == tempdir
3749
p2 = p1 / 'test.txt'
38-
assert str(p2) == "/tmp/test.txt"
50+
assert str(p2) == f"{tempdir}/test.txt"
3951
assert p2.write_text('test')
4052
assert p2.read_text() == "test"
4153
assert p2.is_file()
@@ -48,4 +60,5 @@ def test_OMCPath_local():
4860

4961
if __name__ == '__main__':
5062
test_OMCPath_docker()
63+
test_OMCPath_local()
5164
print('DONE')

0 commit comments

Comments
 (0)