Skip to content

[WIP] sphinx_gallery_expected_error code-block directive #930

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

smarie
Copy link

@smarie smarie commented Mar 21, 2022

Will fix #912

@smarie
Copy link
Author

smarie commented Mar 22, 2022

@larsoner there seem to be an error on CI happening when the following line is executed : from mayavi import mlab

https://dev.azure.com/sphinx-gallery/sphinx-gallery/_build/results?buildId=638&view=logs&j=0b648da4-fe3e-53a0-45c5-9a162ff06918&t=684eab53-20d4-5801-24d9-b15ea59a3d0b&l=225

May I assume that this is probably not related to my code so far ?
That way I will continue working on pushing the additional mods required to implement the feature.

@larsoner larsoner mentioned this pull request Mar 22, 2022
@larsoner
Copy link
Contributor

Fixed in #932, feel free to rebase or merge to fix CIs here

@smarie
Copy link
Author

smarie commented Mar 22, 2022

Thanks ! let's see if it goes well now.

github-merge-queue bot pushed a commit to Deltares/imod-python that referenced this pull request Nov 7, 2024
Fixes #1273

# Description
Add example of cleanup utilities to the user guide. I think it shows a
common use-case for cleaning up data.

Technically the most challenging issue was to work around the fact that
sphinx_gallery doesn't have an option to select expected errors in
specific code blocks. There is [this
PR](sphinx-gallery/sphinx-gallery#930) to
introduce this, but unfortunately for us this has not been finished yet.

I resorted to trapping the error and printing it with a context manager,
that seemed like the cleanest solution to me. I added this small context
to the public API, so that users can also read in the online
documentation what the context manager does.

# Checklist

- [x] Links to correct issue
- [x] Update changelog, if changes affect users
- [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737``
- [x] Unit tests were added
- [x] **If feature added**: Added/extended example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding a sphinx_gallery_expected_error code-block option to show an expected error
3 participants