summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-11-06 09:11:20 +0100
committerGeorg Brandl <georg@python.org>2014-11-06 09:11:20 +0100
commit8192aafb386f514b43d7d0a9c7e7ef0fcf38aa61 (patch)
tree6273a94f82972c08f4456ef0705bf69df12366b9
parent67785d166cd86f16bd0a66ff4408ff56bba1b839 (diff)
downloadsphinx-8192aafb386f514b43d7d0a9c7e7ef0fcf38aa61.tar.gz
Add a basic test for sphinx.apidoc.
-rw-r--r--tests/test_apidoc.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test_apidoc.py b/tests/test_apidoc.py
new file mode 100644
index 00000000..3bc16f5c
--- /dev/null
+++ b/tests/test_apidoc.py
@@ -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)