(tmp_path, plot_html_show_source_link)
| 166 | |
| 167 | @pytest.mark.parametrize('plot_html_show_source_link', [0, 1]) |
| 168 | def 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 | |
| 186 | def test_plot_html_show_source_link_custom_basename(tmp_path): |
nothing calls this directly
no test coverage detected
searching dependent graphs…