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

Function test_show_source_link_true

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

Source from the content-addressed store, hash-verified

147
148@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])
149def test_show_source_link_true(tmp_path, plot_html_show_source_link):
150 # Test that a source link is generated if :show-source-link: is true,
151 # whether or not plot_html_show_source_link is true.
152 shutil.copyfile(tinypages / 'conf.py', tmp_path / 'conf.py')
153 shutil.copytree(tinypages / '_static', tmp_path / '_static')
154 doctree_dir = tmp_path / 'doctrees'
155 (tmp_path / 'index.rst').write_text("""
156.. plot::
157 :show-source-link: true
158
159 plt.plot(range(2))
160""")
161 html_dir = tmp_path / '_build' / 'html'
162 build_sphinx_html(tmp_path, doctree_dir, html_dir, extra_args=[
163 '-D', f'plot_html_show_source_link={plot_html_show_source_link}'])
164 assert len(list(html_dir.glob("**/index-1.py"))) == 1
165
166
167@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])

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…