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