2013-12-26 23:23:47 -06:00
|
|
|
"""
|
|
|
|
test_templating
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Test templating.
|
|
|
|
|
2019-12-31 23:27:43 -06:00
|
|
|
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
|
2013-12-26 23:23:47 -06:00
|
|
|
:license: BSD, see LICENSE for details.
|
|
|
|
"""
|
|
|
|
|
2017-01-05 10:14:47 -06:00
|
|
|
import pytest
|
2018-02-19 07:39:14 -06:00
|
|
|
|
2017-06-17 20:25:34 -05:00
|
|
|
from sphinx.ext.autosummary.generate import setup_documenters
|
2013-12-26 23:23:47 -06:00
|
|
|
|
|
|
|
|
2017-01-05 10:14:47 -06:00
|
|
|
@pytest.mark.sphinx('html', testroot='templating')
|
2017-06-17 20:25:34 -05:00
|
|
|
def test_layout_overloading(make_app, app_params):
|
|
|
|
args, kwargs = app_params
|
|
|
|
app = make_app(*args, **kwargs)
|
2018-01-06 09:05:48 -06:00
|
|
|
setup_documenters(app)
|
2014-09-21 10:17:02 -05:00
|
|
|
app.builder.build_update()
|
2013-12-26 23:23:47 -06:00
|
|
|
|
2020-01-31 20:58:51 -06:00
|
|
|
result = (app.outdir / 'index.html').read_text()
|
2013-12-26 23:23:47 -06:00
|
|
|
assert '<!-- layout overloading -->' in result
|
|
|
|
|
|
|
|
|
2017-01-05 10:14:47 -06:00
|
|
|
@pytest.mark.sphinx('html', testroot='templating')
|
2017-06-17 20:25:34 -05:00
|
|
|
def test_autosummary_class_template_overloading(make_app, app_params):
|
|
|
|
args, kwargs = app_params
|
|
|
|
app = make_app(*args, **kwargs)
|
2018-01-06 09:05:48 -06:00
|
|
|
setup_documenters(app)
|
2014-09-21 10:17:02 -05:00
|
|
|
app.builder.build_update()
|
2013-12-26 23:23:47 -06:00
|
|
|
|
2020-01-31 20:58:51 -06:00
|
|
|
result = (app.outdir / 'generated' / 'sphinx.application.TemplateBridge.html').read_text()
|
2013-12-26 23:23:47 -06:00
|
|
|
assert 'autosummary/class.rst method block overloading' in result
|
2020-04-24 09:01:29 -05:00
|
|
|
assert 'foobar' not in result
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.sphinx('html', testroot='templating',
|
|
|
|
confoverrides={'autosummary_context': {'sentence': 'foobar'}})
|
|
|
|
def test_autosummary_context(make_app, app_params):
|
|
|
|
args, kwargs = app_params
|
|
|
|
app = make_app(*args, **kwargs)
|
|
|
|
setup_documenters(app)
|
|
|
|
app.builder.build_update()
|
|
|
|
|
|
|
|
result = (app.outdir / 'generated' / 'sphinx.application.TemplateBridge.html').read_text()
|
|
|
|
assert 'autosummary/class.rst method block overloading' in result
|
|
|
|
assert 'foobar' in result
|