Fix autosummary template overloading cause infinite recursive function call. Closes #1335

This commit is contained in:
Takayuki Shimizukawa
2013-12-27 05:23:47 +00:00
parent dfaecb8779
commit 3d67be3dce
8 changed files with 96 additions and 4 deletions

View File

@@ -0,0 +1,8 @@
{% extends "!autosummary/class.rst" %}
{% block methods %}
.. note:: autosummary/class.rst method block overloading
{{ super() }}
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "!layout.html" %}
{% block extrahead %}
<!-- layout overloading -->
{{ super() }}
{% endblock %}

View File

@@ -0,0 +1,13 @@
Autosummary templating test
===========================
.. autosummary::
:toctree: generated
sphinx.application.Sphinx
.. currentmodule:: sphinx.application
.. autoclass:: TemplateBridge
.. automethod:: render

View File

@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
project = 'Sphinx templating <Tests>'
source_suffix = '.txt'
keep_warnings = True
templates_path = ['_templates']
release = version = '2013.120'
extensions = ['sphinx.ext.autosummary']
autosummary_generate = ['autosummary_templating']

View File

@@ -0,0 +1,7 @@
Welcome to Sphinx Tests's documentation!
========================================
.. toctree::
autosummary_templating

36
tests/test_templating.py Normal file
View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
"""
test_templating
~~~~~~~~~~~~~~~~
Test templating.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from util import test_roots, with_app
def teardown_module():
(test_roots / 'test-templating' / '_build').rmtree(True),
@with_app(buildername='html', srcdir=(test_roots / 'test-templating'))
def test_layout_overloading(app):
app.builder.build_all()
result = (app.outdir / 'contents.html').text(encoding='utf-8')
assert '<!-- layout overloading -->' in result
@with_app(buildername='html', srcdir=(test_roots / 'test-templating'))
def test_autosummary_class_template_overloading(app):
app.builder.build_all()
result = (app.outdir / 'generated' / 'sphinx.application.Sphinx.html').text(
encoding='utf-8')
assert 'autosummary/class.rst method block overloading' in result