diff options
author | Georg Brandl <georg@python.org> | 2014-09-21 17:17:02 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-09-21 17:17:02 +0200 |
commit | d47a7587f9813f2366e2077be051116291bf930e (patch) | |
tree | 08d92669490358b284d2edd9ba4d61b64c52042a /tests/test_ext_coverage.py | |
parent | c5dfd5c7328fe642d0ca2bb51be58253326af17f (diff) | |
download | sphinx-git-d47a7587f9813f2366e2077be051116291bf930e.tar.gz |
Complete test suite overhaul.
* rename a few test modules to make the names more consistent
* do not copy/use Sphinx from build/ (unnecessary without 2to3)
* use a temporary dir for *all* test projects, the source tree
will stay pristine that way (default is tests/build)
* speed up tests by ~3x by splitting up test projects and avoiding
rebuilds
Diffstat (limited to 'tests/test_ext_coverage.py')
-rw-r--r-- | tests/test_ext_coverage.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_ext_coverage.py b/tests/test_ext_coverage.py new file mode 100644 index 000000000..ec1916d94 --- /dev/null +++ b/tests/test_ext_coverage.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +""" + test_coverage + ~~~~~~~~~~~~~ + + Test the coverage builder. + + :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import pickle + +from util import with_app + + +@with_app(buildername='coverage') +def test_build(app, status, warning): + app.builder.build_all() + + py_undoc = (app.outdir / 'python.txt').text() + assert py_undoc.startswith('Undocumented Python objects\n' + '===========================\n') + assert 'test_autodoc\n------------\n' in py_undoc + assert ' * Class -- missing methods:\n' in py_undoc + assert ' * process_docstring\n' in py_undoc + assert ' * function\n' not in py_undoc # these two are documented + assert ' * Class\n' not in py_undoc # in autodoc.txt + + assert ' * mod -- No module named mod' # in the "failed import" section + + c_undoc = (app.outdir / 'c.txt').text() + assert c_undoc.startswith('Undocumented C API elements\n' + '===========================\n') + assert 'api.h' in c_undoc + assert ' * Py_SphinxTest' in c_undoc + + undoc_py, undoc_c = pickle.loads((app.outdir / 'undoc.pickle').bytes()) + assert len(undoc_c) == 1 + # the key is the full path to the header file, which isn't testable + assert list(undoc_c.values())[0] == [('function', 'Py_SphinxTest')] + + assert 'test_autodoc' in undoc_py + assert 'funcs' in undoc_py['test_autodoc'] + assert 'process_docstring' in undoc_py['test_autodoc']['funcs'] + assert 'classes' in undoc_py['test_autodoc'] + assert 'Class' in undoc_py['test_autodoc']['classes'] + assert 'undocmeth' in undoc_py['test_autodoc']['classes']['Class'] |