mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
To simplify, sphinx uses external mock package even if unittest.mock exists.
This commit is contained in:
+2
-1
@@ -13,11 +13,12 @@ from six import BytesIO
|
||||
|
||||
import pickle
|
||||
from docutils import nodes
|
||||
import mock
|
||||
from textwrap import dedent
|
||||
from sphinx.errors import SphinxError
|
||||
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:
|
||||
from docutils.writers.manpage import Writer as ManWriter
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
from six import PY3, iteritems
|
||||
from util import mock
|
||||
import mock
|
||||
|
||||
from util import TestApp, with_app, gen_with_app, with_tempdir, \
|
||||
raises, raises_msg, assert_in, assert_not_in
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
"""
|
||||
|
||||
from docutils import nodes
|
||||
import mock
|
||||
|
||||
from sphinx.domains.std import StandardDomain
|
||||
from util import mock
|
||||
|
||||
|
||||
def test_process_doc_handle_figure_caption():
|
||||
|
||||
@@ -13,7 +13,7 @@ from collections import namedtuple
|
||||
from sphinx import locale
|
||||
from sphinx.environment.managers.indexentries import IndexEntries
|
||||
|
||||
from util import mock
|
||||
import mock
|
||||
|
||||
Environment = namedtuple('Environment', 'indexentries')
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import zlib
|
||||
|
||||
from six import BytesIO
|
||||
from docutils import nodes
|
||||
import mock
|
||||
|
||||
from sphinx import addnodes
|
||||
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, \
|
||||
_get_safe_url, fetch_inventory, INVENTORY_FILENAME
|
||||
|
||||
from util import with_app, with_tempdir, mock
|
||||
from util import with_app, with_tempdir
|
||||
|
||||
|
||||
inventory_v1 = '''\
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest import TestCase
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.ext.napoleon import (_process_docstring, _skip_member, Config,
|
||||
setup)
|
||||
from util import mock
|
||||
import mock
|
||||
|
||||
|
||||
def _private_doc():
|
||||
|
||||
@@ -19,7 +19,7 @@ from unittest import TestCase
|
||||
|
||||
from sphinx.ext.napoleon import Config
|
||||
from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring
|
||||
from util import mock
|
||||
import mock
|
||||
|
||||
|
||||
class NamedtupleSubclass(namedtuple('NamedtupleSubclass', ('attr1', 'attr2'))):
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
import mock
|
||||
|
||||
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',
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
from sphinx.util.fileutil import copy_asset, copy_asset_file
|
||||
from sphinx.jinja2glue import BuiltinTemplateLoader
|
||||
|
||||
from mock import Mock
|
||||
import mock
|
||||
from util import with_tempdir
|
||||
|
||||
|
||||
class DummyTemplateLoader(BuiltinTemplateLoader):
|
||||
def __init__(self):
|
||||
BuiltinTemplateLoader.__init__(self)
|
||||
builder = Mock()
|
||||
builder = mock.Mock()
|
||||
builder.config.templates_path = []
|
||||
builder.app.translater = None
|
||||
self.init(builder)
|
||||
|
||||
@@ -28,12 +28,6 @@ from sphinx.pycode import ModuleAnalyzer
|
||||
|
||||
from path import path, repr_as # NOQA
|
||||
|
||||
try:
|
||||
# Python >=3.3
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
|
||||
__all__ = [
|
||||
'rootdir', 'tempdir', 'raises', 'raises_msg',
|
||||
@@ -41,7 +35,6 @@ __all__ = [
|
||||
'ListOutput', 'TestApp', 'with_app', 'gen_with_app',
|
||||
'path', 'with_tempdir',
|
||||
'sprint', 'remove_unicode_literals',
|
||||
'mock',
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user