Make plot directive errors fail Sphinx builds#31863
Conversation
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. You can also join us on discourse chat for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
|
CI errors are unrelated and fixed through #31865. |
|
|
||
| def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None): | ||
| # Build the pages with warnings turned into errors | ||
| def run_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None): |
There was a problem hiding this comment.
Let's not create a new function for this. Instead, expand build_sphinx_html to cover both cases.
- Add an
expected_returncode=0parameter - Return the
proc
PR summary
Plot execution exceptions are currently converted into Docutils system messages,
so Sphinx does not treat them as warnings and
sphinx-build -Wcan still exitsuccessfully.
Log
PlotErrorexceptions through Sphinx while preserving the existing Docutilssystem message. This makes warning-as-error builds fail when a plot directive
raises an exception.
Add a regression test that builds a page containing a failing plot directive and
checks that the Sphinx build exits unsuccessfully with the exception details.
closes #30899
AI Disclosure
OpenAI Codex was used to analyze the issue, implement the change, and draft the
regression test and pull request description. The resulting changes were reviewed
and validated with the available local checks.
PR checklist