Changed the name of cpustats and netstats and cmdstats to remove the stats part.

This commit is contained in:
Jeremy Fincher 2003-12-01 12:39:38 +00:00
parent 35df9e1cfa
commit f24011559b
3 changed files with 11 additions and 11 deletions

View File

@ -144,7 +144,7 @@ class Status(callbacks.Privmsg):
utils.timeElapsed(ended-started)) utils.timeElapsed(ended-started))
irc.reply(msg, utils.commaAndify(imap(format, L))) irc.reply(msg, utils.commaAndify(imap(format, L)))
def netstats(self, irc, msg, args): def net(self, irc, msg, args):
"""takes no arguments """takes no arguments
Returns some interesting network-related statistics. Returns some interesting network-related statistics.
@ -155,7 +155,7 @@ class Status(callbacks.Privmsg):
(self.recvdMsgs, self.recvdBytes, (self.recvdMsgs, self.recvdBytes,
self.sentMsgs, self.sentBytes)) self.sentMsgs, self.sentBytes))
def cpustats(self, irc, msg, args): def cpu(self, irc, msg, args):
"""takes no arguments """takes no arguments
Returns some interesting CPU-related statistics on the bot. Returns some interesting CPU-related statistics on the bot.
@ -192,10 +192,10 @@ class Status(callbacks.Privmsg):
mem = os.stat('/proc/%s/mem')[7] mem = os.stat('/proc/%s/mem')[7]
response += ' I\'m taking up %s kB of memory.' % mem response += ' I\'m taking up %s kB of memory.' % mem
except Exception: except Exception:
self.log.exception('Uncaught exception in cpustats:') self.log.exception('Uncaught exception in cpu:')
irc.reply(msg, response) irc.reply(msg, response)
def cmdstats(self, irc, msg, args): def cmd(self, irc, msg, args):
"""takes no arguments """takes no arguments
Returns some interesting command-related statistics. Returns some interesting command-related statistics.

View File

@ -44,25 +44,25 @@ class StatusTestCase(PluginTestCase, PluginDocumentation):
self.assertNotError('bestuptime') self.assertNotError('bestuptime')
def testNetstats(self): def testNetstats(self):
self.assertNotError('netstats') self.assertNotError('net')
def testCpustats(self): def testCpustats(self):
try: try:
original = world.startedAt original = world.startedAt
world.startedAt = time.time() world.startedAt = time.time()
self.assertError('cpustats') self.assertError('cpu')
world.startedAt = 0 world.startedAt = 0
self.assertNotError('cpustats') self.assertNotError('cpu')
for s in ['linux', 'freebsd', 'openbsd', 'netbsd']: for s in ['linux', 'freebsd', 'openbsd', 'netbsd']:
if sys.platform.startswith(s): if sys.platform.startswith(s):
self.assertRegexp('cpustats', 'kB') self.assertRegexp('cpu', 'kB')
finally: finally:
world.startedAt = original world.startedAt = original
def testUptime(self): def testUptime(self):
self.assertNotError('uptime') self.assertNotError('uptime')
def testCmdstats(self): def testCmdstats(self):
self.assertNotError('cmdstats') self.assertNotError('cmd')
def testCommands(self): def testCommands(self):
self.assertNotError('commands') self.assertNotError('commands')

View File

@ -63,11 +63,11 @@ class UtilitiesTestCase(PluginTestCase, PluginDocumentation):
def testEcho(self): def testEcho(self):
self.assertHelp('echo') self.assertHelp('echo')
self.assertResponse('echo foo', 'foo') self.assertResponse('echo foo', 'foo')
m = self.getMsg('cpustats') m = self.getMsg('status cpu')
self.assertResponse('echo "%s"' % m.args[1], m.args[1]) self.assertResponse('echo "%s"' % m.args[1], m.args[1])
def testRe(self): def testRe(self):
self.assertResponse('re "m/My children/" [cpustats]', 'My children') self.assertResponse('re "m/My children/" [status cpu]', 'My children')
self.assertResponse('re s/user/luser/g user user', 'luser luser') self.assertResponse('re s/user/luser/g user user', 'luser luser')
self.assertResponse('re s/user/luser/ user user', 'luser user') self.assertResponse('re s/user/luser/ user user', 'luser user')
self.assertNotRegexp('re m/foo/ bar', 'has no attribute') self.assertNotRegexp('re m/foo/ bar', 'has no attribute')