]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Enable the sphinx doctest extension.
authorBen Darnell <ben@bendarnell.com>
Sun, 8 Feb 2015 21:09:00 +0000 (16:09 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 8 Feb 2015 21:09:00 +0000 (16:09 -0500)
docs/Makefile
docs/conf.py
docs/httputil.rst
docs/util.rst
tox.ini

index a4916851af0d0a11076d2fd43f5054ff738573b8..b156c257dd0cbf93dea091defe6bba2e051a7a12 100644 (file)
@@ -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
index d9b4761ce15725bc543488c974d28492358a2c1e..1af8bb626c1eec3768e2c35e9b2c9b49432efee4 100644 (file)
@@ -14,6 +14,7 @@ version = release = tornado.version
 extensions = [
     "sphinx.ext.autodoc",
     "sphinx.ext.coverage",
+    "sphinx.ext.doctest",
     "sphinx.ext.extlinks",
     "sphinx.ext.intersphinx",
     "sphinx.ext.viewcode",
index 4befc65525fb2892688a8e7cdce868187ac704f9..3a7ac1ad5d63e6b37cd399c697bafa5683af683b 100644 (file)
@@ -1,5 +1,9 @@
 ``tornado.httputil`` --- Manipulate HTTP headers and URLs
 =========================================================
 
+.. testsetup::
+
+   from tornado.httputil import *
+
 .. automodule:: tornado.httputil
    :members:
index 162aa974e30387ce9e495289dc29469d3622bd96..0a2012942e3b6b6c6735de2452be9a94260d7126 100644 (file)
@@ -1,5 +1,9 @@
 ``tornado.util`` --- General-purpose utilities
 ==============================================
 
+.. testsetup::
+
+   from tornado.util import *
+
 .. automodule:: tornado.util
     :members:
diff --git a/tox.ini b/tox.ini
index 65bf59ac6c0c78601c50baae337968ec7fbd96ac..1055b234dbfa41818e99b3f426ac4a8885aa82c2 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -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
@@ -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.
@@ -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