-
Notifications
You must be signed in to change notification settings - Fork 50
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
Docstring - HeatCharge docstring error #1798
Conversation
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.
Great, thanks @marc-flex! I agree doctests probably shouldn't fail on warnings, I'm not sure if there is a good way to do that? I've only been able to find things that pollute the example code itself, which is not great.
Yeah I think unfortunately right now we've been resorting to skipping such tests. At least they've been manually verified to work now... You can add |
Unfortunately I don't think that exists. A trick would be to define the whole block inside a function and then skip only the function call, i.e. def f():
... # do stuff here
f() # doctest +SKIP But I don't think we want our examples to look like this... We could consider using xdoctest or pytest-doctestplus maybe, which both support that. |
Oh wait, nevermind actually, from the doctestplus page: .. doctest-skip::
>>> import asdf
>>> asdf.open('file.asdf') That might just work? edit: it doesn't :/ |
Sorry on the delay on checking this, I believe I configured the docstring tests on the Lines 244 to 258 in 92dc295
There might be an option to ignore the warnings possibly in the |
It's not really about ignoring warnings though (although that doesn't exist either I think), but the fact that these warnings are logged to stdout, and doctest expects all code and output to be included in the example block, otherwise it raises a |
Yeah agreed. Personally it'd be pretty good if we can update all our docstring examples do be self contained so that it's just a case of copy-pasting for the user and this way we can actually validate it runs properly. However, it's a bigger effort. In any case for warnings, there's the |
Skip tests with warning
b027ac4
to
3d76674
Compare
Thanks for having a look! |
Yeah I'd say that's fine for now. We should probably revisit the doctests at some point though, I've opened an issue (#1800) |
This PR fixes one docstring error. The test still doesn't pass because some routines raise warnings.
These warnings are there by design so we may want to consider relaxing this test so that warnings are ignored? @daquintero @momchil-flex