99
1010skip_python_older_312 = pytest .mark .skipif (
1111 sys .version_info < (3 , 12 ),
12- reason = "OMCPath only working for Python >= 3.12 (definition of pathlib.PurePath) ." ,
12+ reason = "OMCPath(non-local) only working for Python >= 3.12." ,
1313)
1414
1515
16- @skip_on_windows
17- @skip_python_older_312
18- def test_OMCPath_docker ():
19- omcp = OMPython .OMCProcessDocker (docker = "openmodelica/openmodelica:v1.25.0-minimal" )
20- om = OMPython .OMCSessionZMQ (omc_process = omcp )
21- assert om .sendExpression ("getVersion()" ) == "OpenModelica 1.25.0"
16+ def test_OMCPath_OMCSessionZMQ ():
17+ om = OMPython .OMCSessionZMQ ()
18+
19+ _run_OMCPath_checks (om )
20+
21+ del om
22+
23+
24+ def test_OMCPath_OMCProcessLocal ():
25+ omp = OMPython .OMCProcessLocal ()
26+ om = OMPython .OMCSessionZMQ (omc_process = omp )
2227
2328 _run_OMCPath_checks (om )
2429
25- del omcp
2630 del om
2731
2832
33+ @skip_on_windows
2934@skip_python_older_312
30- def test_OMCPath_local ():
31- om = OMPython .OMCSessionZMQ ()
35+ def test_OMCPath_OMCProcessDocker ():
36+ omcp = OMPython .OMCProcessDocker (docker = "openmodelica/openmodelica:v1.25.0-minimal" )
37+ om = OMPython .OMCSessionZMQ (omc_process = omcp )
38+ assert om .sendExpression ("getVersion()" ) == "OpenModelica 1.25.0"
3239
3340 _run_OMCPath_checks (om )
3441
42+ del omcp
3543 del om
3644
3745
3846@pytest .mark .skip (reason = "Not able to run WSL on github" )
39- def test_OMCPath_WSL ():
47+ @skip_python_older_312
48+ def test_OMCPath_OMCProcessWSL ():
4049 omcp = OMPython .OMCProcessWSL (
4150 wsl_omc = 'omc' ,
4251 wsl_user = 'omc' ,
@@ -52,14 +61,18 @@ def test_OMCPath_WSL():
5261
5362def _run_OMCPath_checks (om : OMPython .OMCSessionZMQ ):
5463 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
64+ p2 = p1 / 'test'
65+ p2 .mkdir ()
66+ assert p2 .is_dir ()
67+ p3 = p2 / '..' / p2 .name / 'test.txt'
68+ assert p3 .is_file () is False
69+ assert p3 .write_text ('test' )
70+ assert p3 .is_file ()
71+ assert p3 .size () > 0
72+ p3 = p3 .resolve ().absolute ()
73+ assert str (p3 ) == str ((p2 / 'test.txt' ).resolve ().absolute ())
74+ assert p3 .read_text () == "test"
75+ assert p3 .is_file ()
76+ assert p3 .parent .is_dir ()
77+ assert p3 .unlink () is None
78+ assert p3 .is_file () is False
0 commit comments