Skip to content

Commit 2dadf3e

Browse files
committed
[test_OMCPath] use omcpath_tempdir() instead of hard-coded tempdir definition
1 parent a97bdd0 commit 2dadf3e

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

tests/test_OMCPath.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def test_OMCPath_docker():
2020
om = OMPython.OMCSessionZMQ(omc_process=omcp)
2121
assert om.sendExpression("getVersion()") == "OpenModelica 1.25.0"
2222

23-
tempdir = '/tmp'
24-
25-
_run_OMCPath_checks(tempdir, om)
23+
_run_OMCPath_checks(om)
2624

2725
del omcp
2826
del om
@@ -32,13 +30,7 @@ def test_OMCPath_docker():
3230
def test_OMCPath_local():
3331
om = OMPython.OMCSessionZMQ()
3432

35-
# use different tempdir for Windows and Linux
36-
if sys.platform.startswith("win"):
37-
tempdir = 'C:/temp'
38-
else:
39-
tempdir = '/tmp'
40-
41-
_run_OMCPath_checks(tempdir, om)
33+
_run_OMCPath_checks(om)
4234

4335
del om
4436

@@ -52,23 +44,20 @@ def test_OMCPath_WSL():
5244
)
5345
om = OMPython.OMCSessionZMQ(omc_process=omcp)
5446

55-
tempdir = '/tmp'
56-
57-
_run_OMCPath_checks(tempdir, om)
47+
_run_OMCPath_checks(om)
5848

5949
del omcp
6050
del om
6151

6252

63-
def _run_OMCPath_checks(tempdir: str, om: OMPython.OMCSessionZMQ):
64-
p1 = om.omcpath(tempdir).resolve().absolute()
65-
assert str(p1) == tempdir
53+
def _run_OMCPath_checks(om: OMPython.OMCSessionZMQ):
54+
p1 = om.omcpath_tempdir()
6655
p2 = p1 / '..' / p1.name / 'test.txt'
6756
assert p2.is_file() is False
6857
assert p2.write_text('test')
6958
assert p2.is_file()
7059
p2 = p2.resolve().absolute()
71-
assert str(p2) == f"{tempdir}/test.txt"
60+
assert str(p2) == f"{str(p1)}/test.txt"
7261
assert p2.read_text() == "test"
7362
assert p2.is_file()
7463
assert p2.parent.is_dir()

0 commit comments

Comments
 (0)