feat: Add and update tests for v0.2.0 Python bindings#28
feat: Add and update tests for v0.2.0 Python bindings#28
Conversation
Cover new v0.2.0 APIs: 3D grids, symmetry BCs, front/back edges, Poisson solver, logging, library lifecycle, GPU management, status constants, and new exception types. Convert hard skips to conditional skipif for CSV timeseries and stretched grid tests. Add stress tests for boundary conditions and derived fields.
There was a problem hiding this comment.
Pull request overview
Adds/updates pytest coverage for the cfd_python v0.2.0 bindings, focusing on newly introduced APIs (3D grids, Poisson solver, logging, lifecycle, GPU management, new status codes/exceptions) and improving how known-broken behaviors are conditionally skipped.
Changes:
- Added new test modules for Poisson solver, logging, lifecycle/versioning, and GPU device management APIs.
- Expanded existing tests for 3D grid creation, boundary condition constants/edges, status constants + new exception types, and stress/repeat-call safety.
- Replaced hard skips with runtime
skipifchecks for CSV timeseries output and stretched-grid tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_vtk_output.py | Adds runtime probe + skipif gating for CSV timeseries tests. |
| tests/test_output.py | Adds runtime probe + skipif gating for CSV tests; adds invalid-type test for set_output_dir. |
| tests/test_simulation.py | Adds 3D grid tests and additional run_simulation* validation tests. |
| tests/test_poisson_solver.py | New: validates Poisson constants, default params shape, backend queries/setters, and exports. |
| tests/test_logging.py | New: validates log level constants, callback registration behavior, and exports. |
| tests/test_lifecycle.py | New: tests init/finalize/is_initialized + version string/constants behaviors. |
| tests/test_gpu.py | New: tests GPU availability/device info/config APIs and exports. |
| tests/test_errors.py | Adds tests for new exceptions (-8/-9) and new status constants. |
| tests/test_boundary_conditions.py | Extends BC constant coverage (symmetry/front/back) and adds more validation/stress cases. |
| tests/test_derived_fields.py | Adds repeated-call stress tests for derived-fields APIs. |
| tests/test_cpu_features.py | Replaces hard skip with runtime skipif detection for stretched grid bug; adds stress test. |
| tests/test_module.py | Adds completeness checks ensuring _CORE_EXPORTS entries are accessible and in __all__. |
| tests/conftest.py | Minor formatting change to CI failure message for missing C extension. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Let unexpected exceptions from write_csv_timeseries propagate instead of silently skipping the entire test class. Only skip when the function succeeds but fails to create a non-empty file (the known issue).
Only skip TestCreateGridStretched when the known formula bug is detected, not when create_grid_stretched raises an unexpected error.
Add autouse fixture to snapshot/restore is_initialized() state so lifecycle tests don't leak side-effects to other test modules.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
The constant was removed from _CORE_EXPORTS in 3a56067 but remained in the test _PRESETS list, causing 3 failures on CI.
The module-level probe ran create_grid_stretched at import time, which could break test collection for the entire module on unexpected errors. Move the probe into a helper function called from an autouse fixture, so failures surface as test errors rather than import errors.
The C extension raises RuntimeError via raise_cfd_error() for invalid device IDs. The test was catching (ValueError, RuntimeError) which would never match ValueError with the current implementation.
Cover new v0.2.0 APIs: 3D grids, symmetry BCs, front/back edges, Poisson solver, logging, library lifecycle, GPU management, status constants, and new exception types. Convert hard skips to conditional skipif for CSV timeseries and stretched grid tests. Add stress tests for boundary conditions and derived fields.