C-Star is a python package for setting up and running ocean model simulations, with a particular focus on marine carbon dioxide removal (mCDR) applications.
Test individual steps of the existing integration tests
Focus effort on steps with many options / combinations of behaviour
Imagine someone smashed the keyboard (/ added a return) somewhere in your codebase - your tests should help you narrow down where this happened as quick as possible
Mutation testing
Fragment construction of the blueprint rather than always using Case.from_blueprint
Fixtures
Can call business logic to set expensive things up (e.g. build ROMS), as long as you also have tests that check that what you assume works in some fixtures actually does work
Can use scope='module'/'session'
Tips
Always run pytest from the root
pytest lets you select specific directories/test modules/ tests classes/ tests to run
pytest has other options like selecting via glob (I think)
Formatting tests can take inspiration from xarray.tests.test_formatting.py and the stdlib's pprint module
Some general tips about unit testing:
C-Star unit test structure
Ideas for how to write tests
return
) somewhere in your codebase - your tests should help you narrow down where this happened as quick as possibleCase.from_blueprint
Fixtures
scope='module'/'session'
Tips
xarray.tests.test_formatting.py
and the stdlib'spprint
modulepytest.mark