1
# -*- coding: utf-8 -*-
6
Test the coverage builder.
8
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
9
:license: BSD, see LICENSE for details.
14
from util import with_app
17
@with_app(buildername='coverage')
18
def test_build(app, status, warning):
19
app.builder.build_all()
21
py_undoc = (app.outdir / 'python.txt').text()
22
assert py_undoc.startswith('Undocumented Python objects\n'
23
'===========================\n')
24
assert 'test_autodoc\n------------\n' in py_undoc
25
assert ' * Class -- missing methods:\n' in py_undoc
26
assert ' * process_docstring\n' in py_undoc
27
assert ' * function\n' not in py_undoc # these two are documented
28
assert ' * Class\n' not in py_undoc # in autodoc.txt
30
assert ' * mod -- No module named mod' # in the "failed import" section
32
c_undoc = (app.outdir / 'c.txt').text()
33
assert c_undoc.startswith('Undocumented C API elements\n'
34
'===========================\n')
35
assert 'api.h' in c_undoc
36
assert ' * Py_SphinxTest' in c_undoc
38
undoc_py, undoc_c = pickle.loads((app.outdir / 'undoc.pickle').bytes())
39
assert len(undoc_c) == 1
40
# the key is the full path to the header file, which isn't testable
41
assert list(undoc_c.values())[0] == set([('function', 'Py_SphinxTest')])
43
assert 'test_autodoc' in undoc_py
44
assert 'funcs' in undoc_py['test_autodoc']
45
assert 'process_docstring' in undoc_py['test_autodoc']['funcs']
46
assert 'classes' in undoc_py['test_autodoc']
47
assert 'Class' in undoc_py['test_autodoc']['classes']
48
assert 'undocmeth' in undoc_py['test_autodoc']['classes']['Class']