Fixed the nesting bug with testEval and testCalc.

This commit is contained in:
Jeremy Fincher 2003-10-29 23:40:14 +00:00
parent e556e783b1
commit 58cf080109
3 changed files with 5 additions and 3 deletions

View File

@ -52,6 +52,7 @@ import callbacks
class Misc(callbacks.Privmsg): class Misc(callbacks.Privmsg):
priority = sys.maxint priority = sys.maxint
def invalidCommand(self, irc, msg, tokens): def invalidCommand(self, irc, msg, tokens):
#debug.printf('Misc.invalidCommand called')
if conf.replyWhenNotCommand: if conf.replyWhenNotCommand:
command = tokens and tokens[0] or '' command = tokens and tokens[0] or ''
irc.error(msg, '%r is not a valid command.' % command) irc.error(msg, '%r is not a valid command.' % command)

View File

@ -340,7 +340,7 @@ def formatArgumentError(method, name=None):
class IrcObjectProxy: class IrcObjectProxy:
"A proxy object to allow proper nested of commands (even threaded ones)." "A proxy object to allow proper nested of commands (even threaded ones)."
def __init__(self, irc, msg, args): def __init__(self, irc, msg, args):
#debug.printf('__init__: %s' % args) #debug.printf('IrcObjectProxy.__init__: %s' % args)
self.irc = irc self.irc = irc
self.msg = msg self.msg = msg
self.args = args self.args = args
@ -370,6 +370,7 @@ class IrcObjectProxy:
def _callInvalidCommands(self): def _callInvalidCommands(self):
for cb in self.irc.callbacks: for cb in self.irc.callbacks:
#debug.printf('Trying to call %s.invalidCommand' % cb.name())
if self.finished: if self.finished:
break break
if hasattr(cb, 'invalidCommand'): if hasattr(cb, 'invalidCommand'):
@ -381,7 +382,7 @@ class IrcObjectProxy:
name = canonicalName(self.args[0]) name = canonicalName(self.args[0])
cbs = findCallbackForCommand(self, name) cbs = findCallbackForCommand(self, name)
if len(cbs) == 0: if len(cbs) == 0:
if self.irc.nick == self.msg.nick: if self.irc.nick == self.msg.nick and not world.testing:
return return
for cb in self.irc.callbacks: for cb in self.irc.callbacks:
if isinstance(cb, PrivmsgRegexp): if isinstance(cb, PrivmsgRegexp):

View File

@ -35,7 +35,7 @@ import conf
import Owner import Owner
class OwnerTestCase(PluginTestCase, PluginDocumentation): class OwnerTestCase(PluginTestCase, PluginDocumentation):
plugins = () plugins = ('Utilities',)
def testEval(self): def testEval(self):
try: try:
originalConfAllowEval = conf.allowEval originalConfAllowEval = conf.allowEval