Skip to content

Conversation

BradyPlanden
Copy link
Member

  • Adds initial Casadi function based integration tests
  • Removes simplistic unit tests

@BradyPlanden BradyPlanden requested a review from a team as a code owner October 14, 2025 08:59
Copy link
Member

@MarcBerliner MarcBerliner left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@BradyPlanden BradyPlanden merged commit afd14d3 into testing-suite Oct 15, 2025
@BradyPlanden BradyPlanden deleted the test-suite-updates branch October 15, 2025 07:50
Comment on lines +9 to +14
try:
import casadi

CASADI_AVAILABLE = True
except ImportError:
CASADI_AVAILABLE = False
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend using casadi = pytest.importorskip("casadi") for this. https://docs.pytest.org/en/stable/reference/reference.html#pytest-importorskip

These tests verify interactions between different components
and may require more complex setup or be slower to run.
These tests verify that the C++ pybindings work correctly when called from Python
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
These tests verify that the C++ pybindings work correctly when called from Python
These tests verify that the C++ bindings work correctly when called from Python

import pybammsolvers

pytestmark = pytest.mark.unit
assert hasattr(pybammsolvers, "idaklu")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert hasattr(pybammsolvers, "idaklu")
import pybammsolvers.idaklu

hasattr will only check if the attribute exists, but not actually import it – which means that we aren't testing whether the extension module is importable unless we use an import statement.

Comment on lines +39 to +41
# JAX integration
assert hasattr(idaklu_module, "IdakluJax")
assert hasattr(idaklu_module, "create_idaklu_jax")
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Copy link
Member Author

Choose a reason for hiding this comment

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

For these tests, the package is already imported in the conftest.py, so we are checking that the imported package has the corresponding attributes. Unless I'm missing something here?

Comment on lines +43 to +47
# Verify they're callable/instantiable
assert callable(idaklu_module.solution)
assert callable(idaklu_module.VectorNdArray)
assert callable(idaklu_module.VectorSolution)
assert callable(idaklu_module.create_idaklu_jax)
Copy link
Member

@agriyakhetarpal agriyakhetarpal Oct 15, 2025

Choose a reason for hiding this comment

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

These can be replaced with imports as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above, checking that they are callable after import

@agriyakhetarpal
Copy link
Member

agriyakhetarpal commented Oct 15, 2025

Ah, just noticed that the PR was merged before I could put in my review. @BradyPlanden, if it's okay, could you perhaps incorporate these suggestions in another PR (or add them in #69)?

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.

3 participants