Skip to content

Commit c71b137

Browse files
committed
[test_OMCPath] cleanup; use the same code for local OMC and docker based OMC
1 parent 4b58c03 commit c71b137

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

tests/test_OMCPath.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,7 @@ def test_OMCPath_docker():
2222

2323
tempdir = '/tmp'
2424

25-
p1 = om.omcpath(tempdir).resolve().absolute()
26-
assert str(p1) == tempdir
27-
p2 = p1 / '..' / p1.name / 'test.txt'
28-
assert p2.is_file() is False
29-
assert p2.write_text('test')
30-
assert p2.is_file()
31-
p2 = p2.resolve().absolute()
32-
assert str(p2) == f"{tempdir}/test.txt"
33-
assert p2.read_text() == "test"
34-
assert p2.is_file()
35-
assert p2.parent.is_dir()
36-
assert p2.unlink()
37-
assert p2.is_file() is False
25+
_run_OMCPath_checks(tempdir, om)
3826

3927
del omcp
4028
del om
@@ -50,6 +38,12 @@ def test_OMCPath_local():
5038
else:
5139
tempdir = '/tmp'
5240

41+
_run_OMCPath_checks(tempdir, om)
42+
43+
del om
44+
45+
46+
def _run_OMCPath_checks(tempdir: str, om: OMPython.OMCSessionZMQ):
5347
p1 = om.omcpath(tempdir).resolve().absolute()
5448
assert str(p1) == tempdir
5549
p2 = p1 / '..' / p1.name / 'test.txt'
@@ -63,10 +57,3 @@ def test_OMCPath_local():
6357
assert p2.parent.is_dir()
6458
assert p2.unlink()
6559
assert p2.is_file() is False
66-
67-
del om
68-
69-
70-
if __name__ == '__main__':
71-
test_OMCPath_docker()
72-
print('DONE')

0 commit comments

Comments
 (0)