mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add a basic test for sphinx.apidoc.
This commit is contained in:
parent
db57e82afe
commit
e6fa449e85
42
tests/test_apidoc.py
Normal file
42
tests/test_apidoc.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
test_apidoc
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
Test the sphinx.apidoc module.
|
||||||
|
|
||||||
|
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||||
|
:license: BSD, see LICENSE for details.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from sphinx import apidoc
|
||||||
|
|
||||||
|
from util import with_tempdir, with_app, rootdir
|
||||||
|
|
||||||
|
|
||||||
|
@with_tempdir
|
||||||
|
def test_simple(tempdir):
|
||||||
|
codedir = rootdir / 'root'
|
||||||
|
outdir = tempdir / 'out'
|
||||||
|
args = ['sphinx-apidoc', '-o', outdir, '-F', codedir]
|
||||||
|
apidoc.main(args)
|
||||||
|
|
||||||
|
assert (outdir / 'conf.py').isfile()
|
||||||
|
assert (outdir / 'autodoc_fodder.rst').isfile()
|
||||||
|
assert (outdir / 'index.rst').isfile()
|
||||||
|
|
||||||
|
@with_app('text', srcdir=outdir)
|
||||||
|
def assert_build(app, status, warning):
|
||||||
|
app.build()
|
||||||
|
print(status.getvalue())
|
||||||
|
print(warning.getvalue())
|
||||||
|
|
||||||
|
sys.path.append(codedir)
|
||||||
|
try:
|
||||||
|
assert_build()
|
||||||
|
finally:
|
||||||
|
sys.path.remove(codedir)
|
Loading…
Reference in New Issue
Block a user