8000 Ensure updated monkey-patching of sphinx-gallery EXAMPLE_HEADER (#23092) · matplotlib/matplotlib@ae830fa · GitHub
[go: up one dir, main page]

Skip to content

Commit ae830fa

Browse files
authored
Ensure updated monkey-patching of sphinx-gallery EXAMPLE_HEADER (#23092)
We have copied the EXAMPLE_HEADER and patched it (#22405). This ensures we are notified if sphinx-gallery changes the EXAMPLE_HEADER. See the test docstring for more details.
1 parent b5fc36e commit ae830fa

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lib/matplotlib/tests/test_doc.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pytest
2+
3+
4+
def test_sphinx_gallery_example_header():
5+
"""
6+
We have copied EXAMPLE_HEADER and modified it to include meta keywords.
7+
This test monitors that the version we have copied is still the same as
8+
the EXAMPLE_HEADER in sphinx-gallery. If sphinx-gallery changes its
9+
EXAMPLE_HEADER, this test will start to fail. In that case, please update
10+
the monkey-patching of EXAMPLE_HEADER in conf.py.
11+
"""
12+
gen_rst = pytest.importorskip('sphinx_gallery.gen_rst')
13+
14+
EXAMPLE_HEADER = """
15+
.. DO NOT EDIT.
16+
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
17+
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
18+
.. "{0}"
19+
.. LINE NUMBERS ARE GIVEN BELOW.
20+
21+
.. only:: html
22+
23+
.. note::
24+
:class: sphx-glr-download-link-note
25+
26+
Click :ref:`here <sphx_glr_download_{1}>`
27+
to download the full example code{2}
28+
29+
.. rst-class:: sphx-glr-example-title
30+
31+
.. _sphx_glr_{1}:
32+
33+
"""
34+
assert gen_rst.EXAMPLE_HEADER == EXAMPLE_HEADER

0 commit comments

Comments
 (0)
0