mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
To simplify, sphinx uses external mock package even if unittest.mock exists.
This commit is contained in:
parent
ec8dd32e35
commit
487f3db5f6
5
CHANGES
5
CHANGES
@ -44,6 +44,11 @@ Bugs fixed
|
|||||||
* #3038: ``sphinx.ext.math*`` raises TypeError if labels are duplicated
|
* #3038: ``sphinx.ext.math*`` raises TypeError if labels are duplicated
|
||||||
* #3031: incompatibility with LaTeX package ``tocloft``
|
* #3031: incompatibility with LaTeX package ``tocloft``
|
||||||
|
|
||||||
|
Testing
|
||||||
|
--------
|
||||||
|
|
||||||
|
* To simplify, sphinx uses external mock package even if unittest.mock exists.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
@ -13,11 +13,12 @@ from six import BytesIO
|
|||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
import mock
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import SphinxError
|
||||||
import sphinx.builders.linkcheck
|
import sphinx.builders.linkcheck
|
||||||
|
|
||||||
from util import mock, with_app, with_tempdir, rootdir, tempdir, SkipTest, TestApp
|
from util import with_app, with_tempdir, rootdir, tempdir, SkipTest, TestApp
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from docutils.writers.manpage import Writer as ManWriter
|
from docutils.writers.manpage import Writer as ManWriter
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
from six import PY3, iteritems
|
from six import PY3, iteritems
|
||||||
from util import mock
|
import mock
|
||||||
|
|
||||||
from util import TestApp, with_app, gen_with_app, with_tempdir, \
|
from util import TestApp, with_app, gen_with_app, with_tempdir, \
|
||||||
raises, raises_msg, assert_in, assert_not_in
|
raises, raises_msg, assert_in, assert_not_in
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
import mock
|
||||||
|
|
||||||
from sphinx.domains.std import StandardDomain
|
from sphinx.domains.std import StandardDomain
|
||||||
from util import mock
|
|
||||||
|
|
||||||
|
|
||||||
def test_process_doc_handle_figure_caption():
|
def test_process_doc_handle_figure_caption():
|
||||||
|
@ -13,7 +13,7 @@ from collections import namedtuple
|
|||||||
from sphinx import locale
|
from sphinx import locale
|
||||||
from sphinx.environment.managers.indexentries import IndexEntries
|
from sphinx.environment.managers.indexentries import IndexEntries
|
||||||
|
|
||||||
from util import mock
|
import mock
|
||||||
|
|
||||||
Environment = namedtuple('Environment', 'indexentries')
|
Environment = namedtuple('Environment', 'indexentries')
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import zlib
|
|||||||
|
|
||||||
from six import BytesIO
|
from six import BytesIO
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
import mock
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.ext.intersphinx import setup as intersphinx_setup
|
from sphinx.ext.intersphinx import setup as intersphinx_setup
|
||||||
@ -22,7 +23,7 @@ from sphinx.ext.intersphinx import read_inventory, \
|
|||||||
load_mappings, missing_reference, _strip_basic_auth, _read_from_url, \
|
load_mappings, missing_reference, _strip_basic_auth, _read_from_url, \
|
||||||
_get_safe_url, fetch_inventory, INVENTORY_FILENAME
|
_get_safe_url, fetch_inventory, INVENTORY_FILENAME
|
||||||
|
|
||||||
from util import with_app, with_tempdir, mock
|
from util import with_app, with_tempdir
|
||||||
|
|
||||||
|
|
||||||
inventory_v1 = '''\
|
inventory_v1 = '''\
|
||||||
|
@ -16,7 +16,7 @@ from unittest import TestCase
|
|||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
from sphinx.ext.napoleon import (_process_docstring, _skip_member, Config,
|
from sphinx.ext.napoleon import (_process_docstring, _skip_member, Config,
|
||||||
setup)
|
setup)
|
||||||
from util import mock
|
import mock
|
||||||
|
|
||||||
|
|
||||||
def _private_doc():
|
def _private_doc():
|
||||||
|
@ -19,7 +19,7 @@ from unittest import TestCase
|
|||||||
|
|
||||||
from sphinx.ext.napoleon import Config
|
from sphinx.ext.napoleon import Config
|
||||||
from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring
|
from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring
|
||||||
from util import mock
|
import mock
|
||||||
|
|
||||||
|
|
||||||
class NamedtupleSubclass(namedtuple('NamedtupleSubclass', ('attr1', 'attr2'))):
|
class NamedtupleSubclass(namedtuple('NamedtupleSubclass', ('attr1', 'attr2'))):
|
||||||
|
@ -12,9 +12,11 @@
|
|||||||
import os
|
import os
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
from sphinx.theming import Theme, ThemeError
|
from sphinx.theming import Theme, ThemeError
|
||||||
|
|
||||||
from util import with_app, raises, mock, path
|
from util import with_app, raises, path
|
||||||
|
|
||||||
|
|
||||||
@with_app(confoverrides={'html_theme': 'ziptheme',
|
@with_app(confoverrides={'html_theme': 'ziptheme',
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
from sphinx.util.fileutil import copy_asset, copy_asset_file
|
from sphinx.util.fileutil import copy_asset, copy_asset_file
|
||||||
from sphinx.jinja2glue import BuiltinTemplateLoader
|
from sphinx.jinja2glue import BuiltinTemplateLoader
|
||||||
|
|
||||||
from mock import Mock
|
import mock
|
||||||
from util import with_tempdir
|
from util import with_tempdir
|
||||||
|
|
||||||
|
|
||||||
class DummyTemplateLoader(BuiltinTemplateLoader):
|
class DummyTemplateLoader(BuiltinTemplateLoader):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
BuiltinTemplateLoader.__init__(self)
|
BuiltinTemplateLoader.__init__(self)
|
||||||
builder = Mock()
|
builder = mock.Mock()
|
||||||
builder.config.templates_path = []
|
builder.config.templates_path = []
|
||||||
builder.app.translater = None
|
builder.app.translater = None
|
||||||
self.init(builder)
|
self.init(builder)
|
||||||
|
@ -28,12 +28,6 @@ from sphinx.pycode import ModuleAnalyzer
|
|||||||
|
|
||||||
from path import path, repr_as # NOQA
|
from path import path, repr_as # NOQA
|
||||||
|
|
||||||
try:
|
|
||||||
# Python >=3.3
|
|
||||||
from unittest import mock
|
|
||||||
except ImportError:
|
|
||||||
import mock
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'rootdir', 'tempdir', 'raises', 'raises_msg',
|
'rootdir', 'tempdir', 'raises', 'raises_msg',
|
||||||
@ -41,7 +35,6 @@ __all__ = [
|
|||||||
'ListOutput', 'TestApp', 'with_app', 'gen_with_app',
|
'ListOutput', 'TestApp', 'with_app', 'gen_with_app',
|
||||||
'path', 'with_tempdir',
|
'path', 'with_tempdir',
|
||||||
'sprint', 'remove_unicode_literals',
|
'sprint', 'remove_unicode_literals',
|
||||||
'mock',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
10
tox.ini
10
tox.ini
@ -9,38 +9,30 @@ deps=
|
|||||||
sqlalchemy
|
sqlalchemy
|
||||||
whoosh
|
whoosh
|
||||||
html5lib
|
html5lib
|
||||||
|
mock
|
||||||
setenv =
|
setenv =
|
||||||
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
|
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
|
||||||
commands=
|
commands=
|
||||||
{envpython} tests/run.py -I py35 -m '^[tT]est' {posargs}
|
{envpython} tests/run.py -I py35 -m '^[tT]est' {posargs}
|
||||||
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
||||||
|
|
||||||
[testenv:py27]
|
|
||||||
deps=
|
|
||||||
mock
|
|
||||||
{[testenv]deps}
|
|
||||||
|
|
||||||
[testenv:pypy]
|
[testenv:pypy]
|
||||||
deps=
|
deps=
|
||||||
mock
|
|
||||||
simplejson
|
simplejson
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:du10]
|
[testenv:du10]
|
||||||
deps=
|
deps=
|
||||||
mock
|
|
||||||
docutils==0.10
|
docutils==0.10
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:du11]
|
[testenv:du11]
|
||||||
deps=
|
deps=
|
||||||
mock
|
|
||||||
docutils==0.11
|
docutils==0.11
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:du12]
|
[testenv:du12]
|
||||||
deps=
|
deps=
|
||||||
mock
|
|
||||||
docutils==0.12
|
docutils==0.12
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user