(mocker)
| 93 | |
| 94 | |
| 95 | def test_discover_external_plugin(mocker): |
| 96 | ep_plugin = metadata.EntryPoint( |
| 97 | "test", "tests.test_factory:Plugin", "commitizen.plugin" |
| 98 | ) |
| 99 | ep_other_plugin = metadata.EntryPoint( |
| 100 | "not-selected", "tests.test_factory::OtherPlugin", "commitizen.not_a_plugin" |
| 101 | ) |
| 102 | eps = [ep_plugin, ep_other_plugin] |
| 103 | |
| 104 | def mock_entrypoints(**kwargs): |
| 105 | group = kwargs.get("group") |
| 106 | return metadata.EntryPoints(ep for ep in eps if ep.group == group) |
| 107 | |
| 108 | mocker.patch.object(metadata, "entry_points", side_effect=mock_entrypoints) |
| 109 | |
| 110 | assert discover_plugins() == {"test": Plugin} |
| 111 | |
| 112 | |
| 113 | def test_discover_internal_plugins(): |
nothing calls this directly
no test coverage detected