-
Notifications
You must be signed in to change notification settings - Fork 64
OMCPath #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
OMCPath #317
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
1193499
[OMCPath] add class
syntron 01af4ba
[OMCPath] add implementation using OMC via sendExpression()
syntron 873ab70
[OMCPath] add pytest (only docker at the moment)
syntron 3019ac3
[OMCPath] TODO items
syntron 5c92c20
[test_OMCPath] mypy fix
syntron e3ecb69
[test_OMCPath] fix end of file
syntron 5b35438
[test_OMCPath] define test using OMCSessionZMQ() locally
syntron 234e4c9
add TODO - need to check Python versions
syntron 676e278
[test_OMCPath] activate docker based on test_docker
syntron 99893cd
[OMCPath] add more functionality and docstrings
syntron c23e57f
[OMCPath] remove TODO entries
syntron 1acd916
[OMCPath] define limited compatibility for Python < 3.12
syntron 7a50441
[OMCSEssionZMQ] use OMCpath
syntron b1efdb1
[OMCSessionZMQ] create a tempdir using omcpath_tempdir()
syntron e8bd3d8
[OMCPath] fix mypy
syntron 84c73be
[OMCPath] add warning message for Python < 3.12
syntron 3fa97b0
[OMCPath] try to make mypy happy ...
syntron 84c7671
[test_OMCPath] only for Python >= 3.12
syntron f256888
[test_OMCPath] update test
syntron 458b875
[OMCPath._omc_resolve] use sendExpression() with parsed=False
syntron 9a16d44
[test_OMCPath] cleanup; use the same code for local OMC and docker ba…
syntron 0ea522e
[test_OMCPath] define test for WSL
syntron 0a67b35
[test_OMCPath] use omcpath_tempdir() instead of hard-coded tempdir de…
syntron 7f86ff6
[OMCPath] spelling fix
syntron f2cd718
[OMCPath] implementation version 3
syntron 63042fb
[OMCSession*] fix flake8 (PyCharm likes the empty lines)
syntron 6328a17
[OMCSessionZMQ] more generic definiton for omcpath_tempdir()
syntron ad7d54f
[OMCPathCompatibility] mypy on github ...
syntron 769bd67
[OMCPathCompatibility] improve log messages
syntron 553933a
[test_OMCPath] update
syntron 6629673
[OMCPathReal] align exists() to the definition used in pathlib
syntron 6f70ad2
[test_OMCPath] fix error
syntron b0368c7
Merge branch 'master' into OMCPath
adeas31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import sys | ||
| import OMPython | ||
| import pytest | ||
|
|
||
| skip_on_windows = pytest.mark.skipif( | ||
| sys.platform.startswith("win"), | ||
| reason="OpenModelica Docker image is Linux-only; skipping on Windows.", | ||
| ) | ||
|
|
||
| skip_python_older_312 = pytest.mark.skipif( | ||
| sys.version_info < (3, 12), | ||
| reason="OMCPath(non-local) only working for Python >= 3.12.", | ||
| ) | ||
|
|
||
|
|
||
| def test_OMCPath_OMCSessionZMQ(): | ||
| om = OMPython.OMCSessionZMQ() | ||
|
|
||
| _run_OMCPath_checks(om) | ||
|
|
||
| del om | ||
|
|
||
|
|
||
| def test_OMCPath_OMCProcessLocal(): | ||
| omp = OMPython.OMCProcessLocal() | ||
| om = OMPython.OMCSessionZMQ(omc_process=omp) | ||
|
|
||
| _run_OMCPath_checks(om) | ||
|
|
||
| del om | ||
|
|
||
|
|
||
| @skip_on_windows | ||
| @skip_python_older_312 | ||
| def test_OMCPath_OMCProcessDocker(): | ||
| omcp = OMPython.OMCProcessDocker(docker="openmodelica/openmodelica:v1.25.0-minimal") | ||
| om = OMPython.OMCSessionZMQ(omc_process=omcp) | ||
| assert om.sendExpression("getVersion()") == "OpenModelica 1.25.0" | ||
|
|
||
| _run_OMCPath_checks(om) | ||
|
|
||
| del omcp | ||
| del om | ||
|
|
||
|
|
||
| @pytest.mark.skip(reason="Not able to run WSL on github") | ||
| @skip_python_older_312 | ||
| def test_OMCPath_OMCProcessWSL(): | ||
| omcp = OMPython.OMCProcessWSL( | ||
| wsl_omc='omc', | ||
| wsl_user='omc', | ||
| timeout=30.0, | ||
| ) | ||
| om = OMPython.OMCSessionZMQ(omc_process=omcp) | ||
|
|
||
| _run_OMCPath_checks(om) | ||
|
|
||
| del omcp | ||
| del om | ||
|
|
||
|
|
||
| def _run_OMCPath_checks(om: OMPython.OMCSessionZMQ): | ||
| p1 = om.omcpath_tempdir() | ||
| p2 = p1 / 'test' | ||
| p2.mkdir() | ||
| assert p2.is_dir() | ||
| p3 = p2 / '..' / p2.name / 'test.txt' | ||
| assert p3.is_file() is False | ||
| assert p3.write_text('test') | ||
| assert p3.is_file() | ||
| assert p3.size() > 0 | ||
| p3 = p3.resolve().absolute() | ||
| assert str(p3) == str((p2 / 'test.txt').resolve().absolute()) | ||
| assert p3.read_text() == "test" | ||
| assert p3.is_file() | ||
| assert p3.parent.is_dir() | ||
| p3.unlink() | ||
| assert p3.is_file() is False |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.