Swapping manual mocking to autodoc_mock_imports

This commit is contained in:
Gareth J. Greenaway 2018-11-12 14:51:02 -08:00
parent 59809a1e1b
commit 0d65304350
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -178,12 +178,7 @@ MOCK_MODULES = [
'msgpack',
]
for mod_name in MOCK_MODULES:
if mod_name == 'psutil':
mock = Mock(mapping={'total': 0}) # Otherwise it will crash Sphinx
else:
mock = Mock()
sys.modules[mod_name] = mock
autodoc_mock_imports = MOCK_MODULES
def mock_decorator_with_params(*oargs, **okwargs):
'''
@ -202,18 +197,6 @@ def mock_decorator_with_params(*oargs, **okwargs):
return Mock()
return inner
# Define a fake version attribute for the following libs.
sys.modules['libcloud'].__version__ = '0.0.0'
sys.modules['msgpack'].version = (1, 0, 0)
sys.modules['psutil'].version_info = (3, 0, 0)
sys.modules['pymongo'].version = '0.0.0'
sys.modules['ntsecuritycon'].STANDARD_RIGHTS_REQUIRED = 0
sys.modules['ntsecuritycon'].SYNCHRONIZE = 0
# Define a fake version attribute for the following libs.
sys.modules['cherrypy'].config = mock_decorator_with_params
# -- Add paths to PYTHONPATH ---------------------------------------------------
try:
docs_basepath = os.path.abspath(os.path.dirname(__file__))