diet test-root: Move testtheme to test-theming

This commit is contained in:
Takeshi KOMIYA 2017-12-13 23:48:07 +09:00
parent 60f3968ef7
commit a8ab1f164b
8 changed files with 19 additions and 14 deletions

View File

@ -29,9 +29,6 @@ numfig = True
rst_epilog = '.. |subst| replace:: global substitution' rst_epilog = '.. |subst| replace:: global substitution'
html_theme = 'testtheme'
html_theme_path = ['.']
html_theme_options = {'testopt': 'testoverride'}
html_sidebars = {'**': 'customsb.html', html_sidebars = {'**': 'customsb.html',
'contents': ['contentssb.html', 'localtoc.html', 'contents': ['contentssb.html', 'localtoc.html',
'globaltoc.html']} 'globaltoc.html']}

View File

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 120 B

View File

@ -377,7 +377,6 @@ def test_static_output(app):
'contents.html': [ 'contents.html': [
(".//meta[@name='hc'][@content='hcval']", ''), (".//meta[@name='hc'][@content='hcval']", ''),
(".//meta[@name='hc_co'][@content='hcval_co']", ''), (".//meta[@name='hc_co'][@content='hcval_co']", ''),
(".//meta[@name='testopt'][@content='testoverride']", ''),
(".//td[@class='label']", r'\[Ref1\]'), (".//td[@class='label']", r'\[Ref1\]'),
(".//td[@class='label']", ''), (".//td[@class='label']", ''),
(".//li[@class='toctree-l1']/a", 'Testing various markup'), (".//li[@class='toctree-l1']/a", 'Testing various markup'),
@ -410,9 +409,6 @@ def test_static_output(app):
(".//a[@href='http://bugs.python.org/issue1000']", "issue 1000"), (".//a[@href='http://bugs.python.org/issue1000']", "issue 1000"),
(".//a[@href='http://bugs.python.org/issue1042']", "explicit caption"), (".//a[@href='http://bugs.python.org/issue1042']", "explicit caption"),
], ],
'_static/statictmpl.html': [
(".//project", 'Sphinx <Tests>'),
],
'genindex.html': [ 'genindex.html': [
# index entries # index entries
(".//a/strong", "Main"), (".//a/strong", "Main"),

View File

@ -252,7 +252,6 @@ def cached_etree_parse():
'contents.html': [ 'contents.html': [
(".//meta[@name='hc'][@content='hcval']", ''), (".//meta[@name='hc'][@content='hcval']", ''),
(".//meta[@name='hc_co'][@content='hcval_co']", ''), (".//meta[@name='hc_co'][@content='hcval_co']", ''),
(".//meta[@name='testopt'][@content='testoverride']", ''),
(".//dt[@class='label']/span[@class='brackets']", r'Ref1'), (".//dt[@class='label']/span[@class='brackets']", r'Ref1'),
(".//dt[@class='label']", ''), (".//dt[@class='label']", ''),
(".//li[@class='toctree-l1']/a", 'Testing various markup'), (".//li[@class='toctree-l1']/a", 'Testing various markup'),
@ -285,9 +284,6 @@ def cached_etree_parse():
(".//a[@href='http://bugs.python.org/issue1000']", "issue 1000"), (".//a[@href='http://bugs.python.org/issue1000']", "issue 1000"),
(".//a[@href='http://bugs.python.org/issue1042']", "explicit caption"), (".//a[@href='http://bugs.python.org/issue1042']", "explicit caption"),
], ],
'_static/statictmpl.html': [
(".//project", 'Sphinx <Tests>'),
],
'genindex.html': [ 'genindex.html': [
# index entries # index entries
(".//a/strong", "Main"), (".//a/strong", "Main"),

View File

@ -26,10 +26,11 @@ def test_theme_api(app, status, warning):
# test Theme class API # test Theme class API
assert set(app.html_themes.keys()) == \ assert set(app.html_themes.keys()) == \
set(['basic', 'default', 'scrolls', 'agogo', 'sphinxdoc', 'haiku', set(['basic', 'default', 'scrolls', 'agogo', 'sphinxdoc', 'haiku',
'traditional', 'test-theme', 'ziptheme', 'epub', 'nature', 'traditional', 'epub', 'nature', 'pyramid', 'bizstyle', 'classic', 'nonav',
'pyramid', 'bizstyle', 'classic', 'nonav', 'parent', 'child']) 'test-theme', 'ziptheme', 'staticfiles', 'parent', 'child'])
assert app.html_themes['test-theme'] == app.srcdir / 'test_theme/test-theme' assert app.html_themes['test-theme'] == app.srcdir / 'test_theme' / 'test-theme'
assert app.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip' assert app.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip'
assert app.html_themes['staticfiles'] == app.srcdir / 'test_theme' / 'staticfiles'
# test Theme instance API # test Theme instance API
theme = app.builder.theme theme = app.builder.theme
@ -94,3 +95,18 @@ def test_double_inheriting_theme(app, status, warning):
def test_nested_zipped_theme(app, status, warning): def test_nested_zipped_theme(app, status, warning):
assert app.builder.theme.name == 'child' assert app.builder.theme.name == 'child'
app.build() # => not raises TemplateNotFound app.build() # => not raises TemplateNotFound
@pytest.mark.sphinx(testroot='theming',
confoverrides={'html_theme': 'staticfiles'})
def test_staticfiles(app, status, warning):
app.build()
assert (app.outdir / '_static' / 'staticimg.png').exists()
assert (app.outdir / '_static' / 'statictmpl.html').exists()
assert (app.outdir / '_static' / 'statictmpl.html').text() == (
'<!-- testing static templates -->\n'
'<html><project>Python</project></html>'
)
result = (app.outdir / 'index.html').text()
assert '<meta name="testopt" content="optdefault" />' in result