(source_dir, doctree_dir, html_dir, extra_args=None)
| 17 | |
| 18 | |
| 19 | def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None): |
| 20 | # Build the pages with warnings turned into errors |
| 21 | extra_args = [] if extra_args is None else extra_args |
| 22 | cmd = [sys.executable, '-msphinx', '-W', '-b', 'html', |
| 23 | '-d', str(doctree_dir), str(source_dir), str(html_dir), *extra_args] |
| 24 | # On CI, gcov emits warnings (due to agg headers being included with the |
| 25 | # same name in multiple extension modules -- but we don't care about their |
| 26 | # coverage anyways); hide them using GCOV_ERROR_FILE. |
| 27 | proc = subprocess_run_for_testing( |
| 28 | cmd, capture_output=True, text=True, |
| 29 | env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull} |
| 30 | ) |
| 31 | out = proc.stdout |
| 32 | err = proc.stderr |
| 33 | |
| 34 | assert proc.returncode == 0, \ |
| 35 | f"sphinx build failed with stdout:\n{out}\nstderr:\n{err}\n" |
| 36 | if err: |
| 37 | pytest.fail(f"sphinx build emitted the following warnings:\n{err}") |
| 38 | |
| 39 | assert html_dir.is_dir() |
| 40 | |
| 41 | |
| 42 | def test_tinypages(tmp_path): |
no test coverage detected
searching dependent graphs…