summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac-HD <zac.hatfield.dodds@gmail.com>2017-11-16 18:28:30 +1100
committerZac-HD <zac.hatfield.dodds@gmail.com>2018-02-09 10:39:25 +1100
commit973f2680d61d87db321c74ba3d3a74fa720163d5 (patch)
treea19aeeac4f0b264c432a54b30a7e385fcdc04d00
parentc2cd4f6a40a1a9ee7c1c0d9e1586734fc28d7fed (diff)
downloadsphinx-git-973f2680d61d87db321c74ba3d3a74fa720163d5.tar.gz
Add ext.autodoc + ext.doctest test root
-rw-r--r--AUTHORS1
-rw-r--r--CHANGES5
-rw-r--r--tests/roots/test-ext-doctest-with-autodoc/conf.py8
-rw-r--r--tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py0
-rw-r--r--tests/roots/test-ext-doctest-with-autodoc/dir/bar.py4
-rw-r--r--tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst4
-rw-r--r--tests/roots/test-ext-doctest-with-autodoc/foo.py5
-rw-r--r--tests/roots/test-ext-doctest-with-autodoc/index.rst4
-rw-r--r--tests/test_ext_doctest.py18
9 files changed, 47 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index 226900310..a480bf122 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -34,6 +34,7 @@ Other contributors, listed alphabetically, are:
* Hernan Grecco -- search improvements
* Horst Gutmann -- internationalization support
* Martin Hans -- autodoc improvements
+* Zac Hatfield-Dodds -- doctest reporting improvements
* Doug Hellmann -- graphviz improvements
* Tim Hoffmann -- theme improvements
* Timotheus Kampik - JS theme & search enhancements
diff --git a/CHANGES b/CHANGES
index 95bb43a89..9c6d9ef66 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,7 @@ Bugs fixed
* #4531: autosummary: methods are not treated as attributes
* #4538: autodoc: ``sphinx.ext.autodoc.Options`` has been moved
* #4539: autodoc emits warnings for partialmethods
+* #4223: doctest: failing tests reported in wrong file, at wrong line
Testing
--------
@@ -190,7 +191,7 @@ Bugs fixed
* #3962: sphinx-apidoc does not recognize implicit namespace packages correctly
* #4094: C++, allow empty template argument lists.
* C++, also hyperlink types in the name of declarations with qualified names.
-* C++, do not add index entries for declarations inside concepts.
+* C++, do not add index entries for declarations inside concepts.
* C++, support the template disambiguator for dependent names.
* #4314: For PDF 'howto' documents, numbering of code-blocks differs from the
one of figures and tables
@@ -284,7 +285,7 @@ Bugs fixed
* #1421: Respect the quiet flag in sphinx-quickstart
* #4281: Race conditions when creating output directory
* #4315: For PDF 'howto' documents, ``latex_toplevel_sectioning='part'`` generates
- ``\chapter`` commands
+ ``\chapter`` commands
* #4214: Two todolist directives break sphinx-1.6.5
* Fix links to external option docs with intersphinx (refs: #3769)
* #4091: Private members not documented without :undoc-members:
diff --git a/tests/roots/test-ext-doctest-with-autodoc/conf.py b/tests/roots/test-ext-doctest-with-autodoc/conf.py
new file mode 100644
index 000000000..1b8773f6f
--- /dev/null
+++ b/tests/roots/test-ext-doctest-with-autodoc/conf.py
@@ -0,0 +1,8 @@
+from os import path
+import sys
+
+sys.path.insert(0, path.abspath(path.dirname(__file__)))
+
+project = 'test project for doctest + autodoc reporting'
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
+master_doc = 'index'
diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py b/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py
diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py b/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py
new file mode 100644
index 000000000..122fdf736
--- /dev/null
+++ b/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py
@@ -0,0 +1,4 @@
+"""
+>>> 'dir/bar.py:2'
+
+"""
diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst b/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst
new file mode 100644
index 000000000..b2ee47fe3
--- /dev/null
+++ b/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst
@@ -0,0 +1,4 @@
+>>> 'dir/inner.rst:1'
+
+.. automodule:: dir.bar
+ :members:
diff --git a/tests/roots/test-ext-doctest-with-autodoc/foo.py b/tests/roots/test-ext-doctest-with-autodoc/foo.py
new file mode 100644
index 000000000..9f62a19b1
--- /dev/null
+++ b/tests/roots/test-ext-doctest-with-autodoc/foo.py
@@ -0,0 +1,5 @@
+"""
+
+>>> 'foo.py:3'
+
+"""
diff --git a/tests/roots/test-ext-doctest-with-autodoc/index.rst b/tests/roots/test-ext-doctest-with-autodoc/index.rst
new file mode 100644
index 000000000..09d1239cf
--- /dev/null
+++ b/tests/roots/test-ext-doctest-with-autodoc/index.rst
@@ -0,0 +1,4 @@
+.. automodule:: foo
+ :members:
+
+>>> 'index.rst:4'
diff --git a/tests/test_ext_doctest.py b/tests/test_ext_doctest.py
index 7d907d086..1b57e22c1 100644
--- a/tests/test_ext_doctest.py
+++ b/tests/test_ext_doctest.py
@@ -55,3 +55,21 @@ def test_is_allowed_version():
def cleanup_call():
global cleanup_called
cleanup_called += 1
+
+
+@pytest.mark.sphinx('doctest', testroot='ext-doctest-with-autodoc')
+def test_reporting_with_autodoc(app, status, warning, capfd):
+ # Patch builder to get a copy of the output
+ written = []
+ app.builder._warn_out = written.append
+ app.builder.build_all()
+ lines = '\n'.join(written).split('\n')
+ failures = [l for l in lines if l.startswith('File')]
+ expected = [
+ 'File "dir/inner.rst", line 1, in default',
+ 'File "dir/bar.py", line 2, in default',
+ 'File "foo.py", line 3, in default',
+ 'File "index.rst", line 4, in default',
+ ]
+ for location in expected:
+ assert location in failures