Fixed false warning when importing a local module
This commit is contained in:
parent
30a620e449
commit
80fd76bd1e
3 changed files with 16 additions and 0 deletions
|
|
@ -90,6 +90,11 @@ def _resolve_module_placeholders(modules, module_name, visit_path, resolved):
|
|||
if child["type"] != "placeholder":
|
||||
continue
|
||||
|
||||
if child["original_path"] in modules:
|
||||
module["children"].remove(child)
|
||||
children.pop(child["name"])
|
||||
continue
|
||||
|
||||
imported_from, original_name = child["original_path"].rsplit(".", 1)
|
||||
if imported_from in visit_path:
|
||||
msg = "Cannot resolve cyclic import: {0}, {1}".format(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from . import foo
|
||||
|
||||
def module_level_method(foo, bar):
|
||||
"""A module level method"""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import shutil
|
|||
import pytest
|
||||
import sphinx
|
||||
from sphinx.application import Sphinx
|
||||
import sphinx.util.logging
|
||||
|
||||
|
||||
@pytest.fixture(scope="class")
|
||||
|
|
@ -133,6 +134,14 @@ class TestSimplePackage(object):
|
|||
assert "module_level_method" in index_file
|
||||
|
||||
|
||||
def test_simple_no_false_warnings(builder, caplog):
|
||||
logger = sphinx.util.logging.getLogger("autoapi")
|
||||
logger.logger.addHandler(caplog.handler)
|
||||
builder("pypackageexample")
|
||||
|
||||
assert "Cannot resolve" not in caplog.text
|
||||
|
||||
|
||||
def _test_class_content(builder, class_content):
|
||||
confoverrides = {"autoapi_python_class_content": class_content}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue