Handle older docutils

This commit is contained in:
Kit La Touche
2017-09-06 16:33:12 -06:00
committed by Takeshi KOMIYA
parent f21b9d5892
commit 29a3fd0acb
2 changed files with 24 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
:license: BSD, see LICENSE for details.
"""
import os
import re
import pytest
@@ -35,6 +36,16 @@ def test_autosectionlabel_html(app, status, warning):
'<span class="std std-ref">For UNIX users</span></a></li>')
assert re.search(html, content, re.S)
@pytest.mark.skipif(
os.environ.get('DOCUTILS', None) not in ('0.13.1', '0.14'),
reason='Requires docutils >= 0.13.1',
)
@pytest.mark.sphinx('html', testroot='ext-autosectionlabel')
def test_autosectionlabel_html_apostrophe(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'index.html').text()
html = ('<li><a class="reference internal" '
'href="#this-one-s-got-an-apostrophe">'
'<span class="std std-ref">This ones got an apostrophe'
@@ -46,3 +57,13 @@ def test_autosectionlabel_html(app, status, warning):
@pytest.mark.sphinx('html', testroot='ext-autosectionlabel-prefix-document')
def test_autosectionlabel_prefix_document_html(app, status, warning):
return test_autosectionlabel_html(app, status, warning)
# Re-use test definition from above, just change the test root directory
@pytest.mark.skipif(
os.environ.get('DOCUTILS', None) not in ('0.13.1', '0.14'),
reason='Requires docutils >= 0.13.1',
)
@pytest.mark.sphinx('html', testroot='ext-autosectionlabel-prefix-document')
def test_autosectionlabel_prefix_document_html_apostrophe(app, status, warning):
return test_autosectionlabel_html_apostrophe(app, status, warning)