-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor cube testing objects/mocking with DummyCube
#113
Conversation
Tweak skipped pressure test with DummyCube for future implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty straightforward to me.
My main comment (which only just occurred to me, and clearly is an existing issue) is that a lot of the test assert
statements don't have an explanatory note after them, e.g.:
assert False, "Well this will obviously fail"
It's nice to get an explanation out of pytest
as to why a test failed, rather than having to dig into the test code itself to figure out what's going on. Up to you whether this is dealt with as part of this PR, or as a new issue.
Some of this is related to the process of retro-fitting testing & the way the code operates. Quite often, a function takes inputs, modifies a cube & returns None. Error messages could make it clearer if a value hasn't been set properly. This relates to another element: being unfamiliar with why steps are done, thus not knowing what meaningful error msg to provide (or in some cases, if the code is doing the right thing). There's also a future refactoring step where I suspect simplification could result in shrinking the code & tests. At this stage I'm mainly focusing on code coverage to assist with the rework steps. |
I've added this to #27 for feature fixes too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good to me!
This closes #69.
This PR covers multiple elements to switch tests to using
DummyCube
:Mock
objs masquerading as cubes withDummyCube
mock.patch("umpost.um2netcdf.fix_latlon_coords")
inprocess()
testsmock.patch("umpost.um2netcdf.fix_level_coord")
inprocess()
testsAny comments welcome!