Merge branch '2.0'

This commit is contained in:
Takeshi KOMIYA
2019-03-09 18:12:56 +09:00
13 changed files with 151 additions and 15 deletions

View File

@@ -6,6 +6,6 @@ jobs:
working_directory: /sphinx
steps:
- checkout
- run: /python3.5/bin/pip install -U pip setuptools
- run: /python3.5/bin/pip install -U .[test,websupport]
- run: make test PYTHON=/python3.5/bin/python
- run: /python3.6/bin/pip install -U pip setuptools
- run: /python3.6/bin/pip install -U .[test,websupport]
- run: make test PYTHON=/python3.6/bin/python

View File

@@ -65,6 +65,9 @@ Bugs fixed
* #3079: texinfo: image files are not copied on ``make install-info``
* #5391: A cross reference in heading is rendered as literal
* #5946: C++, fix ``cpp:alias`` problems in LaTeX (and singlehtml)
* #6147: classes attribute of ``citation_reference`` node is lost
* AssertionError is raised when custom ``citation_reference`` node having
classes attribute refers missing citation (refs: #6147)
Testing
--------
@@ -337,6 +340,8 @@ Bugs fixed
* #6028: graphviz: Ensure the graphviz filenames are reproducible
* #6068: doctest: ``skipif`` option may remove the code block from documentation
* #6136: ``:name:`` option for ``math`` directive causes a crash
* #6139: intersphinx: ValueError on failure reporting
* #6135: changes: Fix UnboundLocalError when any module found
Testing
--------

View File

@@ -83,8 +83,7 @@ class ChangesBuilder(Builder):
entry = '<b>%s</b>: <i>%s</i>.' % (descname, ttext)
apichanges.append((entry, changeset.docname, changeset.lineno))
elif descname or changeset.module:
if not changeset.module:
module = _('Builtins')
module = changeset.module or _('Builtins')
if not descname:
descname = _('Module level')
if context:

View File

@@ -173,7 +173,7 @@ def fetch_inventory(app, uri, inv):
f = open(path.join(app.srcdir, inv), 'rb')
except Exception as err:
err.args = ('intersphinx inventory %r not fetchable due to %s: %s',
inv, err.__class__, err)
inv, err.__class__, str(err))
raise
try:
if hasattr(f, 'url'):
@@ -191,7 +191,7 @@ def fetch_inventory(app, uri, inv):
raise ValueError('unknown or unsupported inventory version: %r' % exc)
except Exception as err:
err.args = ('intersphinx inventory %r not readable due to %s: %s',
inv, err.__class__.__name__, err)
inv, err.__class__.__name__, str(err))
raise
else:
return invdata
@@ -234,10 +234,9 @@ def load_mappings(app):
for fail in failures:
logger.info(*fail)
else:
issues = '\n'.join([f[0] % f[1:] for f in failures])
logger.warning(__("failed to reach any of the inventories "
"with the following issues:"))
for fail in failures:
logger.warning(*fail)
"with the following issues:") + "\n" + issues)
if update:
inventories.clear()

View File

@@ -220,7 +220,9 @@ class CitationReferences(SphinxTransform):
ids=citation_ref["ids"])
refnode.source = citation_ref.source or citation_ref.parent.source
refnode.line = citation_ref.line or citation_ref.parent.line
refnode += nodes.Text('[' + cittext + ']')
refnode += nodes.inline(cittext, '[%s]' % cittext)
for class_name in citation_ref.attributes.get('classes', []):
refnode['classes'].append(class_name)
citation_ref.parent.replace(citation_ref, refnode)

View File

@@ -0,0 +1,20 @@
Version markup
--------------
.. versionadded:: 0.6
Some funny **stuff**.
.. versionchanged:: 0.6
Even more funny stuff.
.. deprecated:: 0.6
Boring stuff.
.. versionadded:: 1.2
First paragraph of versionadded.
.. versionchanged:: 1.2
First paragraph of versionchanged.
Second paragraph of versionchanged.

View File

@@ -0,0 +1,24 @@
.. highlightlang:: c
Memory
======
.. c:function:: void* Test_Malloc(size_t n)
Allocate *n* bytes of memory.
.. versionchanged:: 0.6
Can now be replaced with a different allocator.
System
------
Access to the system allocator.
.. versionadded:: 0.6
.. c:function:: void* Test_SysMalloc(size_t n)
Allocate *n* bytes of memory using system allocator.

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
project = 'Sphinx ChangesBuilder tests'
copyright = '2007-2019 by the Sphinx team, see AUTHORS'
version = '0.6'
release = '0.6alpha1'

View File

@@ -0,0 +1,13 @@
Index for ChangesBuilder tests
==============================
Contents:
.. toctree::
:maxdepth: 2
:caption: Table of Contents
:name: mastertoc
base
c-api
library/utils

View File

@@ -0,0 +1,25 @@
:mod:`utils` --- Fake utilities module for tests
================================================
.. module:: utils
:synopsis: Utility functions
--------------
The :mod:`utils` module is a pretend python module for changes testing.
Classes
-------
.. class:: Path
Class for handling paths.
.. versionadded:: 0.5
Innovative new way to handle paths.
.. deprecated:: 0.6
So, that was a bad idea it turns out.

View File

@@ -54,10 +54,10 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
# note: this test skips building docs for some builders because they have independent testcase.
# (html, epub, latex, texinfo and manpage)
# (html, changes, epub, latex, texinfo and manpage)
@pytest.mark.parametrize(
"buildername",
['dirhtml', 'singlehtml', 'text', 'changes', 'xml', 'pseudoxml', 'linkcheck'],
['dirhtml', 'singlehtml', 'text', 'xml', 'pseudoxml', 'linkcheck'],
)
@mock.patch('sphinx.builders.linkcheck.requests.head',
side_effect=request_session_head)

View File

@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
"""
test_build_changes
~~~~~~~~~~~~~~~~~~
Test the ChangesBuilder class.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import pytest
@pytest.mark.sphinx('changes', testroot='changes')
def test_build(app):
app.build()
# TODO: Use better checking of html content
htmltext = (app.outdir / 'changes.html').text()
assert 'New in version 0.6: Some funny stuff.' in htmltext
assert 'Changed in version 0.6: Even more funny stuff.' in htmltext
assert 'Deprecated since version 0.6: Boring stuff.' in htmltext
path_html = (
'<b>Path</b>: <i>deprecated:</i> Deprecated since version 0.6:'
' So, that was a bad idea it turns out.')
assert path_html in htmltext
malloc_html = (
'<b>Test_Malloc</b>: <i>changed:</i> Changed in version 0.6:'
' Can now be replaced with a different allocator.</a>')
assert malloc_html in htmltext
@pytest.mark.sphinx(
'changes', testroot='changes', srcdir='changes-none',
confoverrides={'version': '0.7', 'release': '0.7b1'})
def test_no_changes(app, status):
app.build()
assert 'no changes in version 0.7.' in status.getvalue()
assert not (app.outdir / 'changes.html').exists()

View File

@@ -391,8 +391,8 @@ def test_html4_output(app, status, warning):
(".//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']", r"\[bar\]"),
(".//a[@class='reference internal'][@href='#baz-qux'][@id='id5']", r"\[baz_qux\]"),
(".//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"),