summaryrefslogtreecommitdiff
path: root/tests/test_build_html.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-12-31 20:43:16 +0900
committerGitHub <noreply@github.com>2017-12-31 20:43:16 +0900
commit1cae50f74833fc3506ebee19462e0a1457638352 (patch)
tree5e7b9714b84288b1ca04438b73611a78aa4c23df /tests/test_build_html.py
parent1b664248f4ed5e00f89574bd6568e86b29a9df0f (diff)
parent0059c05a857f4144e4eea8b3d2908e906cf7de49 (diff)
downloadsphinx-git-1cae50f74833fc3506ebee19462e0a1457638352.tar.gz
Merge branch 'stable' into 4a164170-33e9-4df3-aad2-a13af37b6b43
Diffstat (limited to 'tests/test_build_html.py')
-rw-r--r--tests/test_build_html.py57
1 files changed, 19 insertions, 38 deletions
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index ceeb5f01c..0ccd4da01 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -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')