mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Converted test framework to use the new functions in OwnerCommands.
This commit is contained in:
parent
ab302e5742
commit
40de833c24
17
test/test.py
17
test/test.py
@ -64,6 +64,7 @@ import irclib
|
|||||||
import drivers
|
import drivers
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
import ircutils
|
import ircutils
|
||||||
|
import OwnerCommands
|
||||||
|
|
||||||
fd = file(os.path.join('test', 'rfc2812.msgs'), 'r')
|
fd = file(os.path.join('test', 'rfc2812.msgs'), 'r')
|
||||||
rawmsgs = [line.strip() for line in fd]
|
rawmsgs = [line.strip() for line in fd]
|
||||||
@ -98,11 +99,6 @@ nicks = ['fatjim','scn','moshez','LordVan','MetaCosm','pythong','fishfart',
|
|||||||
|
|
||||||
nicks += [msg.nick for msg in msgs if msg.nick]
|
nicks += [msg.nick for msg in msgs if msg.nick]
|
||||||
|
|
||||||
def loadPlugin(name):
|
|
||||||
moduleInfo = imp.find_module(name, conf.pluginDirs)
|
|
||||||
module = imp.load_module(name, *moduleInfo)
|
|
||||||
return module
|
|
||||||
|
|
||||||
class PluginTestCase(unittest.TestCase):
|
class PluginTestCase(unittest.TestCase):
|
||||||
"""Subclass this to write a test case for a plugin. See test_FunCommands
|
"""Subclass this to write a test case for a plugin. See test_FunCommands
|
||||||
for an example.
|
for an example.
|
||||||
@ -120,15 +116,12 @@ class PluginTestCase(unittest.TestCase):
|
|||||||
while self.irc.takeMsg():
|
while self.irc.takeMsg():
|
||||||
pass
|
pass
|
||||||
if isinstance(self.plugins, str):
|
if isinstance(self.plugins, str):
|
||||||
moduleInfo = imp.find_module(name, conf.pluginDirs)
|
module = OwnerCommands.loadPluginModule(self.plugins)
|
||||||
module = imp.load_module(name, *moduleInfo)
|
cb = OwnerCommands.loadPluginClass(self.irc, module)
|
||||||
plugin = module.Class()
|
|
||||||
self.irc.addCallback(plugin)
|
|
||||||
else:
|
else:
|
||||||
for name in self.plugins:
|
for name in self.plugins:
|
||||||
module = loadPlugin(name)
|
module = OwnerCommands.loadPluginModule(name)
|
||||||
plugin = module.Class()
|
cb = OwnerCommands.loadPluginClass(self.irc, module)
|
||||||
self.irc.addCallback(plugin)
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.irc.die()
|
self.irc.die()
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
Alias = loadPlugin('Alias')
|
Alias = OwnerCommands.loadPluginModule('Alias')
|
||||||
|
|
||||||
|
|
||||||
class FunctionsTest(unittest.TestCase):
|
class FunctionsTest(unittest.TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user