Skip to content

Commit

Permalink
Enable the sphinx doctest extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed Feb 8, 2015
1 parent e6da0c0 commit 0f1c6ee
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ latex:
pdf: latex
cd build/latex && pdflatex -interaction=nonstopmode tornado.tex

.PHONY: doctest
doctest:
sphinx-build -b doctest $(SPHINXOPTS) build/doctest

clean:
rm -rf build
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
Expand Down
4 changes: 4 additions & 0 deletions docs/httputil.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
``tornado.httputil`` --- Manipulate HTTP headers and URLs
=========================================================

.. testsetup::

from tornado.httputil import *

.. automodule:: tornado.httputil
:members:
4 changes: 4 additions & 0 deletions docs/util.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
``tornado.util`` --- General-purpose utilities
==============================================

.. testsetup::

from tornado.util import *

.. automodule:: tornado.util
:members:
24 changes: 19 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ envlist =
{py27,py3}-unittest2,

# 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]
# Most of these are defaults, but if you specify any you can't fall back
Expand Down Expand Up @@ -87,6 +90,8 @@ deps =
py33-asyncio: asyncio
trollius: trollius
py2-monotonic: Monotime
sphinx: sphinx
sphinx: sphinx_rtd_theme

setenv =
# The extension is mandatory on cpython.
Expand Down Expand Up @@ -139,13 +144,22 @@ changedir = {toxworkdir}
# Remove it (it's not a part of {opts}) to only install real releases.
install_command = pip install {opts} {packages}

[testenv:py3-docs]
[testenv:py3-sphinx-docs]
changedir = docs
# For some reason the extension fails to load in this configuration,
# but it's not really needed for docs anyway.
setenv = TORNADO_EXTENSION=0
deps =
sphinx==1.2.2
sphinx_rtd_theme
commands =
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

0 comments on commit 0f1c6ee

Please sign in to comment.