Enable the sphinx doctest extension.

This commit is contained in:
Ben Darnell 2015-02-08 16:09:00 -05:00
parent e6da0c010a
commit 0f1c6eec62
5 changed files with 32 additions and 5 deletions

View File

@ -23,5 +23,9 @@ latex:
pdf: latex pdf: latex
cd build/latex && pdflatex -interaction=nonstopmode tornado.tex cd build/latex && pdflatex -interaction=nonstopmode tornado.tex
.PHONY: doctest
doctest:
sphinx-build -b doctest $(SPHINXOPTS) build/doctest
clean: clean:
rm -rf build rm -rf build

View File

@ -14,6 +14,7 @@ version = release = tornado.version
extensions = [ extensions = [
"sphinx.ext.autodoc", "sphinx.ext.autodoc",
"sphinx.ext.coverage", "sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks", "sphinx.ext.extlinks",
"sphinx.ext.intersphinx", "sphinx.ext.intersphinx",
"sphinx.ext.viewcode", "sphinx.ext.viewcode",

View File

@ -1,5 +1,9 @@
``tornado.httputil`` --- Manipulate HTTP headers and URLs ``tornado.httputil`` --- Manipulate HTTP headers and URLs
========================================================= =========================================================
.. testsetup::
from tornado.httputil import *
.. automodule:: tornado.httputil .. automodule:: tornado.httputil
:members: :members:

View File

@ -1,5 +1,9 @@
``tornado.util`` --- General-purpose utilities ``tornado.util`` --- General-purpose utilities
============================================== ==============================================
.. testsetup::
from tornado.util import *
.. automodule:: tornado.util .. automodule:: tornado.util
:members: :members:

24
tox.ini
View File

@ -44,7 +44,10 @@ envlist =
{py27,py3}-unittest2, {py27,py3}-unittest2,
# Ensure the sphinx build has no errors or warnings # Ensure the sphinx build has no errors or warnings
py3-docs py3-sphinx-docs,
# Run the doctests via sphinx (which covers things not run
# in the regular test suite and vice versa)
{py2,py3}-sphinx-doctest
[testenv] [testenv]
# Most of these are defaults, but if you specify any you can't fall back # Most of these are defaults, but if you specify any you can't fall back
@ -87,6 +90,8 @@ deps =
py33-asyncio: asyncio py33-asyncio: asyncio
trollius: trollius trollius: trollius
py2-monotonic: Monotime py2-monotonic: Monotime
sphinx: sphinx
sphinx: sphinx_rtd_theme
setenv = setenv =
# The extension is mandatory on cpython. # The extension is mandatory on cpython.
@ -139,13 +144,22 @@ changedir = {toxworkdir}
# Remove it (it's not a part of {opts}) to only install real releases. # Remove it (it's not a part of {opts}) to only install real releases.
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}
[testenv:py3-docs] [testenv:py3-sphinx-docs]
changedir = docs changedir = docs
# For some reason the extension fails to load in this configuration, # For some reason the extension fails to load in this configuration,
# but it's not really needed for docs anyway. # but it's not really needed for docs anyway.
setenv = TORNADO_EXTENSION=0 setenv = TORNADO_EXTENSION=0
deps =
sphinx==1.2.2
sphinx_rtd_theme
commands = commands =
sphinx-build -q -E -n -W -b html . {envtmpdir}/html sphinx-build -q -E -n -W -b html . {envtmpdir}/html
[testenv:py2-sphinx-doctest]
changedir = docs
setenv = TORNADO_EXTENSION=0
commands =
sphinx-build -q -E -n -W -b doctest . {envtmpdir}/doctest
[testenv:py3-sphinx-doctest]
changedir = docs
setenv = TORNADO_EXTENSION=0
commands =
sphinx-build -q -E -n -W -b doctest . {envtmpdir}/doctest