Added a TestPlugin with eval.

This commit is contained in:
Jeremy Fincher 2004-12-17 16:25:18 +00:00
parent 360cba9c63
commit 596abe02f0

View File

@ -109,6 +109,17 @@ class TimeoutError(AssertionError):
def __str__(self): def __str__(self):
return '%r timed out' % self.args[0] return '%r timed out' % self.args[0]
class TestPlugin(callbacks.Privmsg):
def eval(self, irc, msg, args):
"""<text>
This is the help for eval.
"""
try:
irc.reply(repr(eval(' '.join(args))))
except Exception, e:
irc.reply(utils.exnToString(e))
TestInstance = TestPlugin()
class SupyTestCase(unittest.TestCase): class SupyTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
@ -194,6 +205,7 @@ class PluginTestCase(SupyTestCase):
if name not in ('Owner', 'Misc', 'Config'): if name not in ('Owner', 'Misc', 'Config'):
module = Owner.loadPluginModule(name,ignoreDeprecation=True) module = Owner.loadPluginModule(name,ignoreDeprecation=True)
cb = Owner.loadPluginClass(self.irc, module) cb = Owner.loadPluginClass(self.irc, module)
self.irc.addCallback(TestInstance)
for (name, value) in self.config.iteritems(): for (name, value) in self.config.iteritems():
group = conf.supybot group = conf.supybot
parts = registry.split(name) parts = registry.split(name)