##// END OF EJS Templates
handle data_pub in parallel Client
handle data_pub in parallel Client

File last commit:

r7874:4a6836ce
r8103:18c9ccb4
Show More
test_plugin.py
46 lines | 1.3 KiB | text/x-python | PythonLexer
Brian Granger
Finishing work on configurables, plugins and extensions.
r2738 """Tests for plugin.py"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from unittest import TestCase
from IPython.core.plugin import Plugin, PluginManager
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
class FooPlugin(Plugin):
pass
class BarPlugin(Plugin):
pass
class BadPlugin(object):
pass
class PluginTest(TestCase):
def setUp(self):
self.manager = PluginManager()
def test_register_get(self):
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(None, self.manager.get_plugin('foo'))
Brian Granger
Finishing work on configurables, plugins and extensions.
r2738 foo = FooPlugin()
self.manager.register_plugin('foo', foo)
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(foo, self.manager.get_plugin('foo'))
Brian Granger
Finishing work on configurables, plugins and extensions.
r2738 bar = BarPlugin()
self.assertRaises(KeyError, self.manager.register_plugin, 'foo', bar)
bad = BadPlugin()
self.assertRaises(TypeError, self.manager.register_plugin, 'bad')
def test_unregister(self):
foo = FooPlugin()
self.manager.register_plugin('foo', foo)
self.manager.unregister_plugin('foo')
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(None, self.manager.get_plugin('foo'))