Skip to content

Commit

Permalink
Merge pull request #279 from machow/fix-dynamic-method
Browse files Browse the repository at this point in the history
fix: dynamic child should load parent dynamically
  • Loading branch information
machow authored Oct 5, 2023
2 parents 049a7ba + 8b37b14 commit 4036ba3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion quartodoc/autosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def dynamic_alias(
else:
parent_path = mod_name.rsplit(".", 1)[0]

parent = get_object(parent_path, loader=loader)
parent = get_object(parent_path, loader=loader, dynamic=True)
return dc.Alias(attr_name, obj, parent=parent)


Expand Down
1 change: 1 addition & 0 deletions quartodoc/tests/example_star_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from quartodoc.tests.example import * # noqa
15 changes: 15 additions & 0 deletions quartodoc/tests/test_builder_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,21 @@ def test_blueprint_fetch_members_include_inherited():
assert "some_method" in member_names


def test_blueprint_fetch_members_dynamic():
# Since AClass is imported via star import it has to be dynamically
# resolved. This test ensures that the members of AClass also get
# loaded correctly.
name = "quartodoc.tests.example_star_imports:AClass"
auto = lo.Auto(name=name, members=["a_method"], dynamic=True)
bp = blueprint(auto)

method_path = "quartodoc.tests.example_star_imports.AClass.a_method"

assert len(bp.members) == 1
assert bp.members[0].obj.path == method_path
assert bp.members[0].obj.parent.path == name.replace(":", ".")


def test_blueprint_member_options():
auto = lo.Auto(
name="quartodoc.tests.example",
Expand Down

0 comments on commit 4036ba3

Please sign in to comment.