2013-12-27 05:23:47 +00:00
|
|
|
"""Test templating."""
|
|
|
|
|
|
2017-01-06 01:14:47 +09:00
|
|
|
import pytest
|
2018-02-19 22:39:14 +09:00
|
|
|
|
2017-06-18 10:25:34 +09:00
|
|
|
from sphinx.ext.autosummary.generate import setup_documenters
|
2013-12-27 05:23:47 +00:00
|
|
|
|
|
|
|
|
|
2017-01-06 01:14:47 +09:00
|
|
|
@pytest.mark.sphinx('html', testroot='templating')
|
2017-06-18 10:25:34 +09:00
|
|
|
def test_layout_overloading(make_app, app_params):
|
|
|
|
|
args, kwargs = app_params
|
|
|
|
|
app = make_app(*args, **kwargs)
|
2018-01-07 00:05:48 +09:00
|
|
|
setup_documenters(app)
|
2014-09-21 17:17:02 +02:00
|
|
|
app.builder.build_update()
|
2013-12-27 05:23:47 +00:00
|
|
|
|
2022-04-27 03:04:19 +01:00
|
|
|
result = (app.outdir / 'index.html').read_text(encoding='utf8')
|
2013-12-27 05:23:47 +00:00
|
|
|
assert '<!-- layout overloading -->' in result
|
|
|
|
|
|
|
|
|
|
|
2017-01-06 01:14:47 +09:00
|
|
|
@pytest.mark.sphinx('html', testroot='templating')
|
2017-06-18 10:25:34 +09:00
|
|
|
def test_autosummary_class_template_overloading(make_app, app_params):
|
|
|
|
|
args, kwargs = app_params
|
|
|
|
|
app = make_app(*args, **kwargs)
|
2018-01-07 00:05:48 +09:00
|
|
|
setup_documenters(app)
|
2014-09-21 17:17:02 +02:00
|
|
|
app.builder.build_update()
|
2013-12-27 05:23:47 +00:00
|
|
|
|
2022-04-27 03:04:19 +01:00
|
|
|
result = (app.outdir / 'generated' / 'sphinx.application.TemplateBridge.html').read_text(encoding='utf8')
|
2013-12-27 05:23:47 +00:00
|
|
|
assert 'autosummary/class.rst method block overloading' in result
|
2020-04-24 23:01:29 +09: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()
|
|
|
|
|
|
2022-04-27 03:04:19 +01:00
|
|
|
result = (app.outdir / 'generated' / 'sphinx.application.TemplateBridge.html').read_text(encoding='utf8')
|
2020-04-24 23:01:29 +09:00
|
|
|
assert 'autosummary/class.rst method block overloading' in result
|
|
|
|
|
assert 'foobar' in result
|