Skip to content

Commit

Permalink
Remove of usage of internal Sphinx _MockImporter method (#1861)
Browse files Browse the repository at this point in the history
- adds support for proper module mocking in sphinx using  `mock` method

Signed-off-by: Janusz Lisiecki <[email protected]>
  • Loading branch information
JanuszL authored Apr 6, 2020
1 parent 03ecab0 commit 4b68fdb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import sys
import sphinx_rtd_theme
from sphinx.ext.autodoc.importer import mock, _MockImporter
from sphinx.ext.autodoc.mock import mock
from builtins import str
import re
import subprocess
Expand Down Expand Up @@ -49,12 +49,10 @@

# generate table of supported operators and their devices
# mock torch required by supported_op_devices
importer = _MockImporter(["torch"])
importer.load_module("torch")
sys.path.insert(0, os.path.abspath('./'))
import supported_op_devices

supported_op_devices.main(["op_inclusion"])
with mock(["torch"]):
sys.path.insert(0, os.path.abspath('./'))
import supported_op_devices
supported_op_devices.main(["op_inclusion"])

# Uncomment to keep warnings in the output. Useful for verbose build and output debugging.
# keep_warnings = True
Expand Down

0 comments on commit 4b68fdb

Please sign in to comment.