mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable'
This commit is contained in:
@@ -126,24 +126,6 @@ def check_xpath(etree, fname, path, check, be_found=True):
|
||||
[node.text for node in nodes]))
|
||||
|
||||
|
||||
def check_static_entries(outdir):
|
||||
staticdir = outdir / '_static'
|
||||
assert staticdir.isdir()
|
||||
# a file from a directory entry in html_static_path
|
||||
assert (staticdir / 'README').isfile()
|
||||
# a directory from a directory entry in html_static_path
|
||||
assert (staticdir / 'subdir' / 'foo.css').isfile()
|
||||
# a file from a file entry in html_static_path
|
||||
assert (staticdir / 'templated.css').isfile()
|
||||
assert (staticdir / 'templated.css').text().splitlines()[1] == __display_version__
|
||||
# a file from _static, but matches exclude_patterns
|
||||
assert not (staticdir / 'excluded.css').exists()
|
||||
|
||||
|
||||
def check_extra_entries(outdir):
|
||||
assert (outdir / 'robots.txt').isfile()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='warnings')
|
||||
def test_html_warnings(app, warning):
|
||||
app.build()
|
||||
@@ -156,15 +138,6 @@ def test_html_warnings(app, warning):
|
||||
'--- Got:\n' + html_warnings
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', tags=['testtag'], confoverrides={
|
||||
'html_context.hckey_co': 'hcval_co'})
|
||||
@pytest.mark.test_params(shared_result='test_build_html_output')
|
||||
def test_static_output(app):
|
||||
app.build()
|
||||
check_static_entries(app.builder.outdir)
|
||||
check_extra_entries(app.builder.outdir)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||
'images.html': [
|
||||
(".//img[@src='_images/img.png']", ''),
|
||||
@@ -377,7 +350,6 @@ def test_static_output(app):
|
||||
'contents.html': [
|
||||
(".//meta[@name='hc'][@content='hcval']", ''),
|
||||
(".//meta[@name='hc_co'][@content='hcval_co']", ''),
|
||||
(".//meta[@name='testopt'][@content='testoverride']", ''),
|
||||
(".//td[@class='label']", r'\[Ref1\]'),
|
||||
(".//td[@class='label']", ''),
|
||||
(".//li[@class='toctree-l1']/a", 'Testing various markup'),
|
||||
@@ -410,9 +382,6 @@ def test_static_output(app):
|
||||
(".//a[@href='http://bugs.python.org/issue1000']", "issue 1000"),
|
||||
(".//a[@href='http://bugs.python.org/issue1042']", "explicit caption"),
|
||||
],
|
||||
'_static/statictmpl.html': [
|
||||
(".//project", 'Sphinx <Tests>'),
|
||||
],
|
||||
'genindex.html': [
|
||||
# index entries
|
||||
(".//a/strong", "Main"),
|
||||
@@ -1145,16 +1114,28 @@ def test_html_assets(app):
|
||||
assert not (app.outdir / 'subdir' / '.htpasswd').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', confoverrides={'html_sourcelink_suffix': ''})
|
||||
@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_copy_source': False})
|
||||
def test_html_copy_source(app):
|
||||
app.builder.build_all()
|
||||
assert not (app.outdir / '_sources' / 'index.rst.txt').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_sourcelink_suffix': '.txt'})
|
||||
def test_html_sourcelink_suffix(app):
|
||||
app.builder.build_all()
|
||||
content_otherext = (app.outdir / 'otherext.html').text()
|
||||
content_images = (app.outdir / 'images.html').text()
|
||||
assert (app.outdir / '_sources' / 'index.rst.txt').exists()
|
||||
|
||||
assert '<a href="_sources/otherext.foo"' in content_otherext
|
||||
assert '<a href="_sources/images.txt"' in content_images
|
||||
assert (app.outdir / '_sources' / 'otherext.foo').exists()
|
||||
assert (app.outdir / '_sources' / 'images.txt').exists()
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_sourcelink_suffix': '.rst'})
|
||||
def test_html_sourcelink_suffix_same(app):
|
||||
app.builder.build_all()
|
||||
assert (app.outdir / '_sources' / 'index.rst').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_sourcelink_suffix': ''})
|
||||
def test_html_sourcelink_suffix_empty(app):
|
||||
app.builder.build_all()
|
||||
assert (app.outdir / '_sources' / 'index.rst').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='html_entity')
|
||||
|
||||
Reference in New Issue
Block a user