mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.7' into 5048_numbered_toctree
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -17,6 +17,9 @@ Bugs fixed
|
||||
----------
|
||||
|
||||
* #5037: LaTeX ``\sphinxupquote{}`` breaks in Russian
|
||||
* sphinx.testing uses deprecated pytest API; ``Node.get_marker(name)``
|
||||
* #5016: crashed when recommonmark.AutoStrictify is enabled
|
||||
* #5022: latex: crashed with docutils package provided by Debian/Ubuntu
|
||||
* #5048: crashed with numbered toctree
|
||||
|
||||
Testing
|
||||
|
||||
@@ -13,6 +13,7 @@ import re
|
||||
|
||||
from docutils.core import Publisher
|
||||
from docutils.io import FileInput, NullOutput
|
||||
from docutils.parsers.rst import Parser as RSTParser
|
||||
from docutils.readers import standalone
|
||||
from docutils.statemachine import StringList, string2lines
|
||||
from docutils.writers import UnfilteredWriter
|
||||
@@ -282,6 +283,13 @@ def read_doc(app, env, filename):
|
||||
source = input_class(app, env, source=None, source_path=filename,
|
||||
encoding=env.config.source_encoding)
|
||||
parser = app.registry.create_source_parser(app, filename)
|
||||
if parser.__class__.__name__ == 'CommonMarkParser' and parser.settings_spec == ():
|
||||
# a workaround for recommonmark
|
||||
# If recommonmark.AutoStrictify is enabled, the parser invokes reST parser
|
||||
# internally. But recommonmark-0.4.0 does not provide settings_spec for reST
|
||||
# parser. As a workaround, this copies settings_spec for RSTParser to the
|
||||
# CommonMarkParser.
|
||||
parser.settings_spec = RSTParser.settings_spec
|
||||
|
||||
pub = Publisher(reader=reader,
|
||||
parser=parser,
|
||||
|
||||
@@ -39,7 +39,10 @@ def app_params(request, test_params, shared_result, sphinx_test_tempdir, rootdir
|
||||
|
||||
# ##### process pytest.mark.sphinx
|
||||
|
||||
markers = request.node.get_marker("sphinx")
|
||||
if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
|
||||
markers = request.node.iter_markers("sphinx")
|
||||
else:
|
||||
markers = request.node.get_marker("sphinx")
|
||||
pargs = {}
|
||||
kwargs = {} # type: Dict[str, str]
|
||||
|
||||
@@ -86,7 +89,10 @@ def test_params(request):
|
||||
have same 'shared_result' value.
|
||||
**NOTE**: You can not specify shared_result and srcdir in same time.
|
||||
"""
|
||||
env = request.node.get_marker('test_params')
|
||||
if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
|
||||
env = request.node.get_closest_marker('test_params')
|
||||
else:
|
||||
env = request.node.get_marker('test_params')
|
||||
kwargs = env.kwargs if env else {}
|
||||
result = {
|
||||
'shared_result': None,
|
||||
|
||||
@@ -18,7 +18,6 @@ from collections import defaultdict
|
||||
from os import path
|
||||
|
||||
from docutils import nodes, writers
|
||||
from docutils.utils.roman import toRoman
|
||||
from docutils.writers.latex2e import Babel
|
||||
from six import itervalues, text_type
|
||||
|
||||
@@ -32,6 +31,12 @@ from sphinx.util.nodes import clean_astext
|
||||
from sphinx.util.template import LaTeXRenderer
|
||||
from sphinx.util.texescape import tex_escape_map, tex_replace_map
|
||||
|
||||
try:
|
||||
from docutils.utils.roman import toRoman
|
||||
except ImportError:
|
||||
# In Debain/Ubuntu, roman package is provided as roman, not as docutils.utils.roman
|
||||
from roman import toRoman
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA
|
||||
|
||||
@@ -32,7 +32,10 @@ def apidoc(rootdir, tempdir, apidoc_params):
|
||||
|
||||
@pytest.fixture
|
||||
def apidoc_params(request):
|
||||
markers = request.node.get_marker("apidoc")
|
||||
if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
|
||||
markers = request.node.iter_markers("apidoc")
|
||||
else:
|
||||
markers = request.node.get_marker("apidoc")
|
||||
pargs = {}
|
||||
kwargs = {}
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ def setup_command(request, tempdir, rootdir):
|
||||
Run `setup.py build_sphinx` with args and kwargs,
|
||||
pass it to the test and clean up properly.
|
||||
"""
|
||||
marker = request.node.get_marker('setup_command')
|
||||
if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
|
||||
marker = request.node.get_closest_marker('setup_command')
|
||||
else:
|
||||
marker = request.node.get_marker('setup_command')
|
||||
args = marker.args if marker else []
|
||||
|
||||
pkgrootdir = tempdir / 'test-setup'
|
||||
|
||||
Reference in New Issue
Block a user