Skip to content

Commit 28fcb7d

Browse files
Add tests for new list_plugin_distributions() API
- Add test coverage for the new list_plugin_distributions() method - Verify it returns unwrapped importlib.metadata.Distribution objects - Confirm DistFacade wrapping only in legacy list_plugin_distinfo() - Extend existing test_load_setuptools_instantiation test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1dfc4ca commit 28fcb7d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

testing/test_pluginmanager.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,19 @@ def my_distributions():
618618
num = pm.load_setuptools_entrypoints("hello")
619619
assert num == 0 # no plugin loaded by this call
620620

621+
# Test the new modern API returns unwrapped Distribution objects
622+
ret_modern = pm.list_plugin_distributions()
623+
assert len(ret_modern) == 1
624+
assert len(ret_modern[0]) == 2
625+
assert ret_modern[0][0] == plugin
626+
assert ret_modern[0][1] == dist # type: ignore[comparison-overlap]
627+
628+
# Verify the old API wraps with DistFacade while new API doesn't
629+
from pluggy._compat import DistFacade
630+
631+
assert isinstance(ret[0][1], DistFacade)
632+
assert not isinstance(ret_modern[0][1], DistFacade)
633+
621634

622635
def test_add_tracefuncs(he_pm: PluginManager) -> None:
623636
out: list[Any] = []

0 commit comments

Comments
 (0)