191
190
help = self.split_help_commands()['myplug']
192
191
self.assertContainsRe(help, '\[myplug\]')
195
if bzrlib.commands.plugin_cmds.get('myplug', None):
196
del bzrlib.commands.plugin_cmds['myplug']
197
# remove the plugin 'myplug'
198
if getattr(bzrlib.plugins, 'myplug', None):
199
delattr(bzrlib.plugins, 'myplug')
202
class TestPluginFromZip(TestCaseInTempDir):
204
def make_zipped_plugin(self, zip_name, filename):
205
z = zipfile.ZipFile(zip_name, 'w')
206
z.writestr(filename, PLUGIN_TEXT)
209
def check_plugin_load(self, zip_name, plugin_name):
210
self.assertFalse(plugin_name in dir(bzrlib.plugins),
211
'Plugin already loaded')
213
bzrlib.plugin.load_from_zips([zip_name])
214
self.assertTrue(plugin_name in dir(bzrlib.plugins),
215
'Plugin is not loaded')
218
if getattr(bzrlib.plugins, plugin_name, None):
219
delattr(bzrlib.plugins, plugin_name)
221
def test_load_module(self):
222
self.make_zipped_plugin('./test.zip', 'ziplug.py')
223
self.check_plugin_load('./test.zip', 'ziplug')
225
def test_load_package(self):
226
self.make_zipped_plugin('./test.zip', 'ziplug/__init__.py')
227
self.check_plugin_load('./test.zip', 'ziplug')
193
# remove the plugin 'plugin'
194
if getattr(bzrlib.plugins, 'plugin', None):
195
del bzrlib.plugins.plugin