Merge branch '1.8' into 5520_latex_caption_package

This commit is contained in:
Jean-François B authored and GitHub committed 2018-11-14 00:12:27 +01:00
commit 3a512ef68c
4 files changed
+24 -3

No files matched your search

+1
View File
@@ -18,6 +18,7 @@ Bugs fixed
* #5460: html search does not work with some 3rd party themes
* #5520: LaTeX, caption package incompatibility since Sphinx 1.6
* #5614: autodoc: incremental build is broken when builtin modules are imported
Testing
--------
+3 -1
View File
@@ -301,7 +301,9 @@ def get_module_source(modname):
raise PycodeError('error getting filename for %r' % filename, err)
if filename is None and loader:
try:
return 'string', loader.get_source(modname)
filename = loader.get_source(modname)
if filename:
return 'string', filename
except Exception as err:
raise PycodeError('error getting source for %r' % modname, err)
if filename is None:
+1 -1
View File
@@ -224,7 +224,7 @@ def test_generated_files_eol(tempdir):
qs.generate(d)
def assert_eol(filename, eol):
content = filename.bytes().decode('unicode-escape')
content = filename.bytes().decode()
assert all([l[-len(eol):] == eol for l in content.splitlines(True)])
assert_eol(tempdir / 'make.bat', '\r\n')
+19 -1
View File
@@ -12,9 +12,14 @@
import pytest
from mock import patch
from six import PY2
import sphinx
from sphinx.errors import PycodeError
from sphinx.testing.util import strip_escseq
from sphinx.util import (
display_chunk, encode_uri, parselinenos, status_iterator, xmlname_checker
display_chunk, encode_uri, get_module_source, parselinenos, status_iterator,
xmlname_checker
)
from sphinx.util import logging
@@ -42,6 +47,19 @@ def test_display_chunk():
assert display_chunk(('hello', 'sphinx', 'world')) == 'hello .. world'
def test_get_module_source():
if PY2:
assert get_module_source('sphinx') == ('file', sphinx.__file__.replace('.pyc', '.py'))
else:
assert get_module_source('sphinx') == ('file', sphinx.__file__)
# failed to obtain source information from builtin modules
with pytest.raises(PycodeError):
get_module_source('builtins')
with pytest.raises(PycodeError):
get_module_source('itertools')
@pytest.mark.sphinx('dummy')
@patch('sphinx.util.console._tw', 40) # terminal width = 40
def test_status_iterator(app, status, warning):