test: refactor shared 2D mesh helper into pytest fixture#5342
test: refactor shared 2D mesh helper into pytest fixture#5342agriyakhetarpal merged 4 commits intopybamm-team:mainfrom
Conversation
agriyakhetarpal
left a comment
There was a problem hiding this comment.
Nice work, thanks, @swastim01! I've launched the workflows and we will be good to go with this once the tests pass. One more change: since get_mesh_for_testing_2d is no longer used, could you please remove it?
agriyakhetarpal
left a comment
There was a problem hiding this comment.
@swastim01 almost there, just one more import to remove – see failing tests!
Hey @agriyakhetarpal, I missed that earlier, thanks for catching it! I’ve removed the leftover import now. |
There was a problem hiding this comment.
All good now, sorry this took me so long to review @swastim01! Thank you! I'll merge when tests pass
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5342 +/- ##
==========================================
- Coverage 98.60% 98.03% -0.57%
==========================================
Files 324 327 +3
Lines 28219 28690 +471
==========================================
+ Hits 27824 28126 +302
- Misses 395 564 +169 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR refactors the reusable 2D mesh generation helper from
tests/shared.pyinto a pytest fixture defined intests/conftest.py.The change removes repeated mesh construction boilerplate across multiple test files and aligns with recommended fixture usage in PyBaMM tests.
Several tests have been updated to consume the shared fixture directly, while preserving existing test semantics.
Context: This follows the discussion and suggestion in #5294 and #5295 regarding using fixtures for shared setup with substantial reuse.
Contributes to issue: #4502
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)
Important checks:
Please confirm the following before marking the PR as ready for review:
nox -s pre-commitnox -s testsnox -s doctests