MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_show_source_link_false

Function test_show_source_link_false

lib/matplotlib/tests/test_sphinxext.py:168–183  ·  view source on GitHub ↗
(tmp_path, plot_html_show_source_link)

Source from the content-addressed store, hash-verified

166
167@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])
168def test_show_source_link_false(tmp_path, plot_html_show_source_link):
169 # Test that a source link is NOT generated if :show-source-link: is false,
170 # whether or not plot_html_show_source_link is true.
171 shutil.copyfile(tinypages / 'conf.py', tmp_path / 'conf.py')
172 shutil.copytree(tinypages / '_static', tmp_path / '_static')
173 doctree_dir = tmp_path / 'doctrees'
174 (tmp_path / 'index.rst').write_text("""
175.. plot::
176 :show-source-link: false
177
178 plt.plot(range(2))
179""")
180 html_dir = tmp_path / '_build' / 'html'
181 build_sphinx_html(tmp_path, doctree_dir, html_dir, extra_args=[
182 '-D', f'plot_html_show_source_link={plot_html_show_source_link}'])
183 assert len(list(html_dir.glob("**/index-1.py"))) == 0
184
185
186def test_plot_html_show_source_link_custom_basename(tmp_path):

Callers

nothing calls this directly

Calls 1

build_sphinx_htmlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…