Skip to content
Merged
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
14 changes: 12 additions & 2 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
timeout-minutes: 45
strategy:
matrix:
# test for:
Expand Down Expand Up @@ -73,10 +73,20 @@ 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 compatibility layer
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 (v4.0.0 compatibility layer)'

Publish:
name: Publish to PyPI
runs-on: ${{ matrix.os }}
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