mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
commit
6a0e83904a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user