mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Proper ignoring of deprecated plugins.
This commit is contained in:
parent
8eaec18a5e
commit
6e712bb3db
@ -131,8 +131,22 @@ class PluginTestCase(SupyTestCase):
|
|||||||
cleanConfDir = True
|
cleanConfDir = True
|
||||||
cleanDataDir = True
|
cleanDataDir = True
|
||||||
config = {}
|
config = {}
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, methodName='runTest'):
|
||||||
SupyTestCase.__init__(self, *args, **kwargs)
|
originalRunTest = getattr(self, methodName)
|
||||||
|
def runTest(self):
|
||||||
|
run = True
|
||||||
|
if hasattr(self, 'irc') and self.irc:
|
||||||
|
for cb in self.irc.callbacks:
|
||||||
|
cbModule = sys.modules[cb.__class__.__module__]
|
||||||
|
if hasattr(cbModule, 'deprecated') and cbModule.deprecated:
|
||||||
|
print
|
||||||
|
print 'Ignored, %s is deprecated.' % cb.name()
|
||||||
|
run = False
|
||||||
|
if run:
|
||||||
|
originalRunTest()
|
||||||
|
runTest = utils.changeFunctionName(runTest, methodName)
|
||||||
|
setattr(self.__class__, methodName, runTest)
|
||||||
|
SupyTestCase.__init__(self, methodName=methodName)
|
||||||
self.originals = {}
|
self.originals = {}
|
||||||
|
|
||||||
def setUp(self, nick='test'):
|
def setUp(self, nick='test'):
|
||||||
@ -178,10 +192,7 @@ class PluginTestCase(SupyTestCase):
|
|||||||
else:
|
else:
|
||||||
for name in self.plugins:
|
for name in self.plugins:
|
||||||
if name not in ('Owner', 'Misc', 'Config'):
|
if name not in ('Owner', 'Misc', 'Config'):
|
||||||
try:
|
module = Owner.loadPluginModule(name,ignoreDeprecation=True)
|
||||||
module = Owner.loadPluginModule(name)
|
|
||||||
except Owner.Deprecated, e:
|
|
||||||
return utils.exnToString(e)
|
|
||||||
cb = Owner.loadPluginClass(self.irc, module)
|
cb = Owner.loadPluginClass(self.irc, module)
|
||||||
for (name, value) in self.config.iteritems():
|
for (name, value) in self.config.iteritems():
|
||||||
group = conf.supybot
|
group = conf.supybot
|
||||||
@ -203,6 +214,7 @@ class PluginTestCase(SupyTestCase):
|
|||||||
ircdb.ignores.close()
|
ircdb.ignores.close()
|
||||||
ircdb.channels.close()
|
ircdb.channels.close()
|
||||||
SupyTestCase.tearDown(self)
|
SupyTestCase.tearDown(self)
|
||||||
|
self.irc = None
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
def _feedMsg(self, query, timeout=None, to=None, frm=None,
|
def _feedMsg(self, query, timeout=None, to=None, frm=None,
|
||||||
|
Loading…
Reference in New Issue
Block a user