Merge pull request #4491 from Emantor/fix/autodoc_mock_importer

autodoc: prefer _MockImporter over other importers in sys.meta_path
This commit is contained in:
Takeshi KOMIYA 2018-01-27 22:05:30 +09:00 committed by GitHub
commit 6a0e83904a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,7 @@ class _MockImporter(object):
self.names = names
self.mocked_modules = [] # type: List[str]
# enable hook by adding itself to meta_path
sys.meta_path = sys.meta_path + [self]
sys.meta_path.insert(0, self)
def disable(self):
# remove `self` from `sys.meta_path` to disable import hook