mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Increase minimum Docutils to 0.18
This commit is contained in:
@@ -5,7 +5,6 @@ import re
|
||||
from itertools import chain, cycle
|
||||
from unittest.mock import ANY, call, patch
|
||||
|
||||
import docutils
|
||||
import pytest
|
||||
from html5lib import HTMLParser
|
||||
|
||||
@@ -407,39 +406,6 @@ def test_html5_output(app, cached_etree_parse, fname, expect):
|
||||
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
||||
|
||||
|
||||
@pytest.mark.skipif(docutils.__version_info__ >= (0, 18), reason='docutils-0.17 or below is required.')
|
||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||
'index.html': [
|
||||
(".//dt[@class='label']/span[@class='brackets']", r'Ref1'),
|
||||
(".//dt[@class='label']", ''),
|
||||
],
|
||||
'footnote.html': [
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id9'][@id='id1']", r"1"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id10'][@id='id2']", r"2"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#foo'][@id='id3']", r"3"),
|
||||
(".//a[@class='reference internal'][@href='#bar'][@id='id4']/span", r"\[bar\]"),
|
||||
(".//a[@class='reference internal'][@href='#baz-qux'][@id='id5']/span", r"\[baz_qux\]"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id11'][@id='id6']", r"4"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id12'][@id='id7']", r"5"),
|
||||
(".//a[@class='fn-backref'][@href='#id1']", r"1"),
|
||||
(".//a[@class='fn-backref'][@href='#id2']", r"2"),
|
||||
(".//a[@class='fn-backref'][@href='#id3']", r"3"),
|
||||
(".//a[@class='fn-backref'][@href='#id4']", r"bar"),
|
||||
(".//a[@class='fn-backref'][@href='#id5']", r"baz_qux"),
|
||||
(".//a[@class='fn-backref'][@href='#id6']", r"4"),
|
||||
(".//a[@class='fn-backref'][@href='#id7']", r"5"),
|
||||
(".//a[@class='fn-backref'][@href='#id8']", r"6"),
|
||||
],
|
||||
}))
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.test_params(shared_result='test_build_html_output_docutils17')
|
||||
def test_docutils17_output(app, cached_etree_parse, fname, expect):
|
||||
app.build()
|
||||
print(app.outdir / fname)
|
||||
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
||||
|
||||
|
||||
@pytest.mark.skipif(docutils.__version_info__[:2] <= (0, 17), reason='docutils-0.18+ is required.')
|
||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||
'index.html': [
|
||||
(".//div[@class='citation']/span", r'Ref1'),
|
||||
@@ -465,7 +431,7 @@ def test_docutils17_output(app, cached_etree_parse, fname, expect):
|
||||
}))
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.test_params(shared_result='test_build_html_output_docutils18')
|
||||
def test_docutils18_output(app, cached_etree_parse, fname, expect):
|
||||
def test_docutils_output(app, cached_etree_parse, fname, expect):
|
||||
app.build()
|
||||
print(app.outdir / fname)
|
||||
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Test smart quotes."""
|
||||
|
||||
import docutils
|
||||
import pytest
|
||||
from html5lib import HTMLParser
|
||||
|
||||
@@ -44,10 +43,7 @@ def test_man_builder(app, status, warning):
|
||||
app.build()
|
||||
|
||||
content = (app.outdir / 'python.1').read_text(encoding='utf8')
|
||||
if docutils.__version_info__ > (0, 18):
|
||||
assert r'\-\- \(dqSphinx\(dq is a tool that makes it easy ...' in content
|
||||
else:
|
||||
assert r'\-\- "Sphinx" is a tool that makes it easy ...' in content
|
||||
assert r'\-\- \(dqSphinx\(dq is a tool that makes it easy ...' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='latex', testroot='smartquotes', freshenv=True)
|
||||
|
||||
@@ -4,17 +4,9 @@ import pickle
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
from sphinx.versioning import add_uids, get_ratio, merge_doctrees
|
||||
|
||||
try:
|
||||
from docutils.nodes import meta
|
||||
except ImportError:
|
||||
# docutils-0.18.0 or older
|
||||
from docutils.parsers.rst.directives.html import MetaBody
|
||||
meta = MetaBody.meta
|
||||
|
||||
app = original = original_uids = None
|
||||
|
||||
|
||||
@@ -62,8 +54,6 @@ def test_picklablility():
|
||||
copy.settings.warning_stream = None
|
||||
copy.settings.env = None
|
||||
copy.settings.record_dependencies = None
|
||||
for metanode in copy.findall(meta):
|
||||
metanode.__class__ = addnodes.meta
|
||||
loaded = pickle.loads(pickle.dumps(copy, pickle.HIGHEST_PROTOCOL))
|
||||
assert all(getattr(n, 'uid', False) for n in loaded.findall(is_paragraph))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user