Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@ jobs:
verbose: true
emoji: true
job-summary: true
custom-arguments: '-v'
custom-arguments: '-v ./tests'
click-to-expand: true
report-title: 'Test Report'

- name: Run pytest based on v4.0.0
uses: pavelzw/pytest-action@v2
with:
verbose: true
emoji: true
job-summary: true
custom-arguments: '-v ./tests_v400'
click-to-expand: true
report-title: 'Test Report'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the title so we know this test report belongs to v4.0.0 tests.


Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
hooks:
- id: mypy
args: []
exclude: tests/
exclude: 'test|test_v400'
additional_dependencies:
- pyparsing
- types-psutil
Expand Down
Empty file added tests_v400/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions tests_v400/test_ArrayDimension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import OMPython


def test_ArrayDimension(tmp_path):
omc = OMPython.OMCSessionZMQ()

omc.sendExpression(f'cd("{tmp_path.as_posix()}")')

omc.sendExpression('loadString("model A Integer x[5+1,1+6]; end A;")')
omc.sendExpression("getErrorString()")

result = omc.sendExpression("getComponents(A)")
assert result[0][-1] == (6, 7), "array dimension does not match"

omc.sendExpression('loadString("model A Integer y = 5; Integer x[y+1,1+9]; end A;")')
omc.sendExpression("getErrorString()")

result = omc.sendExpression("getComponents(A)")
assert result[-1][-1] == ('y+1', 10), "array dimension does not match"
24 changes: 24 additions & 0 deletions tests_v400/test_FMIExport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import OMPython
import shutil
import os


def test_CauerLowPassAnalog():
mod = OMPython.ModelicaSystem(modelName="Modelica.Electrical.Analog.Examples.CauerLowPassAnalog",
lmodel=["Modelica"])
tmp = mod.getWorkDirectory()
try:
fmu = mod.convertMo2Fmu(fileNamePrefix="CauerLowPassAnalog")
assert os.path.exists(fmu)
finally:
shutil.rmtree(tmp, ignore_errors=True)


def test_DrumBoiler():
mod = OMPython.ModelicaSystem(modelName="Modelica.Fluid.Examples.DrumBoiler.DrumBoiler", lmodel=["Modelica"])
tmp = mod.getWorkDirectory()
try:
fmu = mod.convertMo2Fmu(fileNamePrefix="DrumBoiler")
assert os.path.exists(fmu)
finally:
shutil.rmtree(tmp, ignore_errors=True)
Loading
Loading