Skip to content
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

Add more unit tests #63

Merged
merged 15 commits into from
Oct 30, 2024
Merged

Add more unit tests #63

merged 15 commits into from
Oct 30, 2024

Conversation

Jorgelmh
Copy link
Collaborator

@Jorgelmh Jorgelmh commented Oct 21, 2024

Description

Resolves #12

Add unit tests for the validation of the interface JSON, the modelDescription builder and the template data generated for the CPPFMU code.

How Has This Been Tested?

  • Interface validation.
  • FMU Template data.
  • Model Description XML generator.

Screenshots (if appropriate)

Developer Checklist (before requesting PR review)

  • My code follows the style guidelines of this project
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

I have:

  • commented my code, particularly in hard-to-understand areas
  • performed a self-review of my own code
  • not committed unnecessary formatting changes, thereby occluding the actual changes (e.g. change of tab spacing, eol, etc.)
  • made corresponding changes to the documentation
  • added change to CHANGELOG.md
  • added tests that prove my fix is effective or that my feature works (for core features)

Reviewer checklist

I have:

  • have performed a review of the code
  • tested that the software still works as expected
  • [n/a] checked updates to documentation
  • checked that the CHANGELOG is updated

Copy link
Collaborator

@KristofferSkare KristofferSkare left a comment

Choose a reason for hiding this comment

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

Good work!

Just some minor comments and a suggestion on how the errors can be handled better with pytest.

src/mlfmu/utils/builder.py Outdated Show resolved Hide resolved
tests/utils/test_interface_validation.py Outdated Show resolved Hide resolved
src/mlfmu/types/fmu_component.py Outdated Show resolved Hide resolved
@StephanieKemna
Copy link
Collaborator

Trying to test, but keep getting this error
image

which makes no sense to me. If this is building all in a venvwith local install of pythong, why would it care about some issues I have with system python install?

@StephanieKemna
Copy link
Collaborator

Here's the first part before the ros complaints
image

@StephanieKemna
Copy link
Collaborator

I think the pydantic dependency is not included - several files complain that pydantic could not be resolved.

@StephanieKemna
Copy link
Collaborator

StephanieKemna commented Oct 23, 2024

I did a uv pip install lark, and with that I can run everything fine. So ignore above screenshots for this PR.

I but still think something is wrong with the uv venv though, since it should not need that. So doubting a bit the venv. I even manually activated the venv before trying to test this PR, but no difference.

uv.lock Outdated Show resolved Hide resolved
uv.lock Outdated Show resolved Hide resolved
@StephanieKemna StephanieKemna self-requested a review October 23, 2024 14:29
@ClaasRostock
Copy link
Collaborator

@Jorgelmh
Regarding the matplotlib <-> Sphinx issue: I found the reason: In the python_project_termplate, I added a Sphinx plugin that needs matplotlib. That always worked, because all the projects I worked on until then had matplotlib as dependency anyhow.
mlfmu is the first project that doesn't, which is why it failed - and how we gain a learning :-)
So, the cleaner way for us to solve it is likely to remove the Sphinx plugin in question. Then we neither need matplotlib.
Let me check where exactly that change need to be.

@ClaasRostock
Copy link
Collaborator

@Jorgelmh
docs/source/conf.py -> line 40
"matplotlib.sphinxext.plot_directive",
-> remove that line.

Then also matplotlib can be removed as a dependency.

Copy link
Collaborator

@KristofferSkare KristofferSkare left a comment

Choose a reason for hiding this comment

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

Just a small comment, but it is not important

tests/utils/test_interface_validation.py Outdated Show resolved Hide resolved
@Jorgelmh Jorgelmh merged commit 9caf053 into main Oct 30, 2024
10 checks passed
@StephanieKemna StephanieKemna deleted the enhance/unit-tests branch November 8, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests: Write some tests for existing functionality
4 participants