summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-09 00:59:38 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-09 00:59:38 +0900
commit5cabe8be35ee44ca9a9ddaf5d93e2dd9f62abdc9 (patch)
tree536b92e491bc0118db3ec3e14504a1821b3f6573
parent07a45f84016921c29ce60052673f67224ad8b4d1 (diff)
parent5ec9c4bc9a33102e51376012a52fb49f921cbd9a (diff)
downloadsphinx-git-5cabe8be35ee44ca9a9ddaf5d93e2dd9f62abdc9.tar.gz
Merge branch '2.1.1' into 2.0
-rw-r--r--CHANGES5
-rw-r--r--sphinx/ext/autodoc/importer.py2
-rw-r--r--sphinx/ext/autosummary/generate.py2
-rw-r--r--sphinx/templates/apidoc/package.rst4
-rw-r--r--sphinx/texinputs/sphinx.sty4
-rw-r--r--tests/test_ext_apidoc.py17
-rw-r--r--tests/test_ext_autosummary.py18
7 files changed, 41 insertions, 11 deletions
diff --git a/CHANGES b/CHANGES
index a66ac17d2..eb530f81d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -42,6 +42,11 @@ Features added
Bugs fixed
----------
+* #6442: LaTeX: admonitions of :rst:dir:`note` type can get separated from
+ immediately preceding section title by pagebreak
+* #6448: autodoc: crashed when autodocumenting classes with ``__slots__ = None``
+* #6452: autosummary: crashed when generating document of properties
+
Testing
--------
diff --git a/sphinx/ext/autodoc/importer.py b/sphinx/ext/autodoc/importer.py
index 37bdae8a9..0c6f47039 100644
--- a/sphinx/ext/autodoc/importer.py
+++ b/sphinx/ext/autodoc/importer.py
@@ -128,7 +128,7 @@ def get_object_members(subject, objpath, attrgetter, analyzer=None):
members[name] = Attribute(name, True, value)
# members in __slots__
- if isclass(subject) and hasattr(subject, '__slots__'):
+ if isclass(subject) and getattr(subject, '__slots__', None) is not None:
from sphinx.ext.autodoc import SLOTSATTR
for name in subject.__slots__:
diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py
index ba1ec219a..1bfbb0da4 100644
--- a/sphinx/ext/autosummary/generate.py
+++ b/sphinx/ext/autosummary/generate.py
@@ -221,7 +221,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
get_members(obj, {'attribute', 'property'})
parts = name.split('.')
- if doc.objtype in ('method', 'attribute'):
+ if doc.objtype in ('method', 'attribute', 'property'):
mod_name = '.'.join(parts[:-2])
cls_name = parts[-2]
obj_name = '.'.join(parts[-2:])
diff --git a/sphinx/templates/apidoc/package.rst b/sphinx/templates/apidoc/package.rst
index 0026af34c..ed9f669ea 100644
--- a/sphinx/templates/apidoc/package.rst
+++ b/sphinx/templates/apidoc/package.rst
@@ -40,8 +40,8 @@ Submodules
{{- [submodule, "module"] | join(" ") | e | heading(2) }}
{% endif %}
{{ automodule(submodule, automodule_options) }}
-{%- endfor %}
-{% endif %}
+{% endfor %}
+{%- endif %}
{% endif %}
{%- if not modulefirst and not is_namespace %}
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 6ace6a9ce..184b0d820 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -6,7 +6,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{sphinx}[2019/01/12 v1.8.4 LaTeX package (Sphinx markup)]
+\ProvidesPackage{sphinx}[2019/06/04 v2.1.1 LaTeX package (Sphinx markup)]
% provides \ltx@ifundefined
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
@@ -1444,7 +1444,7 @@
% Some are quite plain
% the spx@notice@bordercolor etc are set in the sphinxadmonition environment
\newenvironment{sphinxlightbox}{%
- \par\allowbreak
+ \par
\noindent{\color{spx@notice@bordercolor}%
\rule{\linewidth}{\spx@notice@border}}\par\nobreak
{\parskip\z@skip\noindent}%
diff --git a/tests/test_ext_apidoc.py b/tests/test_ext_apidoc.py
index c6cf43c7e..34c6ec824 100644
--- a/tests/test_ext_apidoc.py
+++ b/tests/test_ext_apidoc.py
@@ -467,7 +467,8 @@ def test_package_file(tempdir):
outdir = path(tempdir)
(outdir / 'testpkg').makedirs()
(outdir / 'testpkg' / '__init__.py').write_text('')
- (outdir / 'testpkg' / 'example.py').write_text('')
+ (outdir / 'testpkg' / 'hello.py').write_text('')
+ (outdir / 'testpkg' / 'world.py').write_text('')
(outdir / 'testpkg' / 'subpkg').makedirs()
(outdir / 'testpkg' / 'subpkg' / '__init__.py').write_text('')
apidoc_main(['-o', tempdir, tempdir / 'testpkg'])
@@ -488,10 +489,18 @@ def test_package_file(tempdir):
"Submodules\n"
"----------\n"
"\n"
- "testpkg.example module\n"
- "----------------------\n"
+ "testpkg.hello module\n"
+ "--------------------\n"
"\n"
- ".. automodule:: testpkg.example\n"
+ ".. automodule:: testpkg.hello\n"
+ " :members:\n"
+ " :undoc-members:\n"
+ " :show-inheritance:\n"
+ "\n"
+ "testpkg.world module\n"
+ "--------------------\n"
+ "\n"
+ ".. automodule:: testpkg.world\n"
" :members:\n"
" :undoc-members:\n"
" :show-inheritance:\n"
diff --git a/tests/test_ext_autosummary.py b/tests/test_ext_autosummary.py
index 04af9ed85..ae97d3b57 100644
--- a/tests/test_ext_autosummary.py
+++ b/tests/test_ext_autosummary.py
@@ -10,7 +10,7 @@
import sys
from io import StringIO
-from unittest.mock import Mock
+from unittest.mock import Mock, patch
import pytest
from docutils import nodes
@@ -19,6 +19,7 @@ from sphinx import addnodes
from sphinx.ext.autosummary import (
autosummary_table, autosummary_toc, mangle_signature, import_by_name, extract_summary
)
+from sphinx.ext.autosummary.generate import generate_autosummary_docs
from sphinx.testing.util import assert_node, etree_parse
from sphinx.util.docutils import new_document
@@ -286,3 +287,18 @@ def test_autosummary_imported_members(app, status, warning):
' \n' in module)
finally:
sys.modules.pop('autosummary_dummy_package', None)
+
+
+@pytest.mark.sphinx(testroot='ext-autodoc')
+def test_generate_autosummary_docs_property(app):
+ with patch('sphinx.ext.autosummary.generate.find_autosummary_in_files') as mock:
+ mock.return_value = [('target.methods.Base.prop', 'prop', None)]
+ generate_autosummary_docs([], output_dir=app.srcdir, builder=app.builder, app=app)
+
+ content = (app.srcdir / 'target.methods.Base.prop.rst').text()
+ assert content == ("target.methods.Base.prop\n"
+ "========================\n"
+ "\n"
+ ".. currentmodule:: target.methods\n"
+ "\n"
+ ".. autoproperty:: Base.prop")