From f8da745d3fea203aeaa88b8db237f091484d8ee2 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 24 Oct 2003 11:31:48 +0000 Subject: [PATCH] Updated to consider getting the help string an error in assertNotError and assertError. --- test/test.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test.py b/test/test.py index 526d5402e..cc2616de4 100755 --- a/test/test.py +++ b/test/test.py @@ -61,6 +61,14 @@ import ircutils import callbacks import Owner +originalCallbacksGetHelp = callbacks.getHelp +lastGetHelp = 'x'*1000 +def cachingGetHelp(method, name=None): + global lastGetHelp + lastGetHelp = originalCallbacksGetHelp(method, name) + return lastGetHelp +callbacks.getHelp = cachingGetHelp + nicks = ['fatjim','scn','moshez','LordVan','MetaCosm','pythong','fishfart', 'alb','d0rt','jemfinch','StyxAlso','fors','deltab','gd', 'hellz_hunter','are_j|pub_comp','jason_','dreid','sayke_','winjer', @@ -186,8 +194,9 @@ class PluginTestCase(unittest.TestCase): m = self._feedMsg(query) if m is None: raise TimeoutError, query - self.failUnless(m.args[1].startswith('Error:'), - '%r did not error: %s' % (query, m.args[1])) + if lastGetHelp not in m.args[1]: + self.failUnless(m.args[1].startswith('Error:'), + '%r did not error: %s' % (query, m.args[1])) def assertNotError(self, query): m = self._feedMsg(query) @@ -195,6 +204,8 @@ class PluginTestCase(unittest.TestCase): raise TimeoutError, query self.failIf(m.args[1].startswith('Error:'), '%r errored: %s' % (query, m.args[1])) + self.failIf(lastGetHelp in m.args[1], + '%r returned the help string.' % query) def assertNoResponse(self, query, timeout=None): m = self._feedMsg(query, timeout) @@ -408,5 +419,6 @@ if __name__ == '__main__': runner.run(suite) print 'Total asserts: %s' % unittest.asserts world.testing = False + debug._close() # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: