Commit d63e2d8
authored
Clean up code & improve test coverage (#249)
* Fix testModelicaSystemLoop
* Use python3 features to clean up ModelicaSystem
- use f-strings to make sendExpression() arguments easier to read,
- use pathlib.Path to convert \ to / in file paths on Windows
- fix a few bugs (mostly missing spaces in error strings)
* Fix warning in test_linearization
* Add more tests for ModelicaSystem methods
* Add test for ModelicaSystem.getLinear*()
* Add test for ModelicaSystem.getContinuous()
It behaves differently before and after simulate()
* Improve test coverage
* Remove unreachable code
* Add test for ModelicaSystem.optimize()
* Use pathlib.Path in OMCSessionHelper
I'm pretty sure this also fixes a bug:
the only Exception I can see os.path.join() raise in _get_omc_path()
is when self.omhome is None, which shouldn't really happen (the
constructor checks it).
I think the intention was to check whether the file actually exists,
so I do that instead.
* Add tests for simulate() edge cases
* Improve test coverage
* Use setCommandLineOptions()
... instead of raw sendExpression.
Seems cleaner and improves test coverage.
* Use f-strings in OMCSessionZMQ
* Simplify omc_process kill logic
... by dropping Python2 support
* Drop Python2 workarounds
* Use f-strings in OMCSessionZMQ
... except for logging calls. It probably doesn't matter, but the
built-in %-formatting does not run when logging is disabled,
improving performance.
* Remove unreachable code
* Fix _get_omc_path fails on Windows
... probably due to missing .exe suffix.
* Fix createCSVData on Windows
The csv module documentation says to open the file with newline='':
https://docs.python.org/3/library/csv.html#id4
Also, I'm pretty sure this isn't how you are supposed to use csv.writer.
delimiter='\n' doesn't seem right.
We should either let the csv writer actually generate the rows, or
remove it altogether and just write the string rows into the file.
* Do not run omc with shell=True
* Remove last remaining str.format() call1 parent 630229a commit d63e2d8
File tree
5 files changed
+746
-400
lines changed- OMPython
- tests
5 files changed
+746
-400
lines changed
0 commit comments