-
Notifications
You must be signed in to change notification settings - Fork 297
control cube iteration #273
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
Conversation
|
@pelson did you suggest there may be specific problems with this? |
|
It looks a trifle over-engineered...? |
Agreed. It was really just for testing that I discovered it was handy to make it configurable. The extra stuff should certainly all be removed once it has been 'deprecated' for a while and we switch to 'disallow'.
What would you prefer right now? |
Personally I'd go for option one - "reduce to the minimum". |
: test included
|
You might question my use of warnings.catch_warnings, as it is apparently not thread-safe ? If you think this is plainly unwise, I could probably use Mock instead ? |
lib/iris/tests/test_cdm.py
Outdated
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.
I prefer:
with warnings.catch_warnings():
warnings.simplefilter("error")
with self.assertRaises(DeprecationWarning):
for subcube in cube:
passas it is standalone (it does not create cube_iterator for use by later test code) and it's a little clearer (to me at least) than the generator expression. It's still not thread, but I can live with that.
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.
Indeed that is much neater @esc24 -- really rather lovely!
I am still tempted to use subcubes = list(cube) for the iter test expression, but maybe that is not obvious enough?
: clearer test code : don't use DeprecationWarning
|
Improved by @esc24 suggestion. |
|
I think the testcode is now simpler+clearer. |
I don't think we need to worry about it. We run the tests in a single-threaded mode. Even nosetests uses multiple processes, not threads. |
lib/iris/cube.py
Outdated
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.
Docstring is not needed IMHO, a single comment would suffice.
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.
+1
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.
Changing to a comment would also fix the missing blank line from the docstring. ;-)
|
Thanks - good to go. :-) |
Addresses #86
For now:
Future Intentions: