test_doc.py 1015 B

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