def test_add_plugins_from_pkg_resources(self, monkeypatch): # mock entry points import pkg_resources def fake_entries(group): yield pkg_resources.EntryPoint('name1', 'pytest', ('raises',)) monkeypatch.setattr(pkg_resources, 'iter_entry_points', fake_entries) plugins = PluginDict() plugins.add_plugins({}, 'category2') name1 = plugins['name1'] assert isinstance(name1, PluginEntry) assert name1.category == 'category2' assert name1.name == 'name1' assert name1.location == 'pytest:raises'
def plugins(self): plugins = PluginDict() config_dict = {'name1': 'pytest:raises', 'name2': 'mock:Mock'} plugins.add_plugins({'category1': config_dict}, 'category1') return plugins