MoPyRegtest: A Python enabled simple regression testing framework for Modelica models
A lightweight, CI-friendly regression testing framework for Modelica models,
wrapped in Python's unittest module.
Uses OpenModelica for model translation and simulation.
Key features:
- Regression testing — compare simulation results against reference CSV files using configurable metrics and tolerances
- Success-only testing — verify that models compile, build, and simulate successfully (useful for unit test models with built-in assertions)
- Automatic test generation — generate
unittesttest files for entire Modelica libraries via CLI or Python script - CSV comparison — compare two CSV result files directly from the command line
Prerequisites
- Python 3 with
numpyandpandas - OpenModelica (>= 1.13.0) with
omconPATH
Installation
# From PyPI
python3 -m pip install --user mopyregtest
# From source
git clone https://github.com/pstelzig/MoPyRegtest.git
cd MoPyRegtest
python3 -m pip install --user .
Verify the CLI: mopyregtest --help
Tip: If
mopyregtestis not found, check that pip's script directory is on yourPATH.
Runpython3 -m pip uninstall mopyregtest(without confirming) to see where pip installed the executable.
Quick start
Regression test (manual)
import mopyregtest
tester = mopyregtest.RegressionTest(
package_folder="~/.openmodelica/libraries/Modelica 4.0.0+maint.om",
model_in_package="Modelica.Electrical.Analog.Examples.HeatingRectifier",
result_folder="./results",
modelica_version="4.0.0")
tester.compare_result(reference_result="references/HeatingRectifier_res.csv", tol=1e-3)
Success-only test (manual)
tester = mopyregtest.RegressionTest(
package_folder="~/.openmodelica/libraries/Modelica 4.0.0+maint.om",
model_in_package="Modelica.Blocks.Examples.Filter",
result_folder="./results")
tester.check_success()
Auto-generate tests (CLI)
# Regression tests
mopyregtest generate ./gen_tests MyTest ~/".openmodelica/libraries/Modelica 4.0.0+maint.om/" \
Modelica.Blocks.Sources.Sine,Modelica.Blocks.Sources.Step
# Success-only tests
mopyregtest generate --mode=success ./gen_tests MySimTest ~/".openmodelica/libraries/Modelica 4.0.0+maint.om/" \
Modelica.Blocks.Examples.Filter
Compare CSV files (CLI)
mopyregtest compare --metric=Lp_dist --tol=0.015 --validated-cols=y reference.csv actual.csv
Documentation
For detailed usage, metrics reference, and worked examples see the documentation.
Runnable examples are in the examples/ folder.
License
MIT — see LICENSE.
Contributing
Contributions are welcome! Please open an issue or pull request.
Authors
Metadata
Release files for MoPyRegtest 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mopyregtest-0.6.0.tar.gz | 21.6 kB | Without provenance | Details for mopyregtest-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mopyregtest-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for mopyregtest-0.6.0-py3-none-any.whl |
Total release size: 43.6 kB
Release files / mopyregtest-0.6.0.tar.gz
| Download URL | mopyregtest-0.6.0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c27fba411909d900a0bf17558ce35df3a2facb1afbf0b2785927914685d7ff0
|
|
BLAKE2b-256 checksum How to use checksums |
d46a32281482bf188802a2a1f9c45d38be722e11d669597790fb7951ddb02002
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / mopyregtest-0.6.0-py3-none-any.whl
| Download URL | mopyregtest-0.6.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c54f8a1669732183f0391c4387c2dc671245faa266b3085d6e8c0b064db25850
|
|
BLAKE2b-256 checksum How to use checksums |
a8961bda688ee2a13ca42796b1935c6d5605d3afb5c13cb997d1203aa8fa3782
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for MoPyRegtest 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.