mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Changed the name of cpustats and netstats and cmdstats to remove the stats part.
This commit is contained in:
parent
35df9e1cfa
commit
f24011559b
@ -144,7 +144,7 @@ class Status(callbacks.Privmsg):
|
||||
utils.timeElapsed(ended-started))
|
||||
irc.reply(msg, utils.commaAndify(imap(format, L)))
|
||||
|
||||
def netstats(self, irc, msg, args):
|
||||
def net(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
||||
Returns some interesting network-related statistics.
|
||||
@ -155,7 +155,7 @@ class Status(callbacks.Privmsg):
|
||||
(self.recvdMsgs, self.recvdBytes,
|
||||
self.sentMsgs, self.sentBytes))
|
||||
|
||||
def cpustats(self, irc, msg, args):
|
||||
def cpu(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
||||
Returns some interesting CPU-related statistics on the bot.
|
||||
@ -192,10 +192,10 @@ class Status(callbacks.Privmsg):
|
||||
mem = os.stat('/proc/%s/mem')[7]
|
||||
response += ' I\'m taking up %s kB of memory.' % mem
|
||||
except Exception:
|
||||
self.log.exception('Uncaught exception in cpustats:')
|
||||
self.log.exception('Uncaught exception in cpu:')
|
||||
irc.reply(msg, response)
|
||||
|
||||
def cmdstats(self, irc, msg, args):
|
||||
def cmd(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
||||
Returns some interesting command-related statistics.
|
||||
|
@ -44,25 +44,25 @@ class StatusTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertNotError('bestuptime')
|
||||
|
||||
def testNetstats(self):
|
||||
self.assertNotError('netstats')
|
||||
self.assertNotError('net')
|
||||
|
||||
def testCpustats(self):
|
||||
try:
|
||||
original = world.startedAt
|
||||
world.startedAt = time.time()
|
||||
self.assertError('cpustats')
|
||||
self.assertError('cpu')
|
||||
world.startedAt = 0
|
||||
self.assertNotError('cpustats')
|
||||
self.assertNotError('cpu')
|
||||
for s in ['linux', 'freebsd', 'openbsd', 'netbsd']:
|
||||
if sys.platform.startswith(s):
|
||||
self.assertRegexp('cpustats', 'kB')
|
||||
self.assertRegexp('cpu', 'kB')
|
||||
finally:
|
||||
world.startedAt = original
|
||||
def testUptime(self):
|
||||
self.assertNotError('uptime')
|
||||
|
||||
def testCmdstats(self):
|
||||
self.assertNotError('cmdstats')
|
||||
self.assertNotError('cmd')
|
||||
|
||||
def testCommands(self):
|
||||
self.assertNotError('commands')
|
||||
|
@ -63,11 +63,11 @@ class UtilitiesTestCase(PluginTestCase, PluginDocumentation):
|
||||
def testEcho(self):
|
||||
self.assertHelp('echo')
|
||||
self.assertResponse('echo foo', 'foo')
|
||||
m = self.getMsg('cpustats')
|
||||
m = self.getMsg('status cpu')
|
||||
self.assertResponse('echo "%s"' % m.args[1], m.args[1])
|
||||
|
||||
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/ user user', 'luser user')
|
||||
self.assertNotRegexp('re m/foo/ bar', 'has no attribute')
|
||||
|
Loading…
Reference in New Issue
Block a user