/usr/lib/gozerbot/dotest.py is in gozerbot 0.99.1-5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #! /usr/bin/python
#
# move this file to the bot directory
__copyright__ = 'this file is in the public domain'
from gozerbot.users import users
from gozerbot.config import config
from gozerbot.generic import handle_exception, enable_logging
import gozerbot.exit
import unittest, glob, signal, os, sys
nettests = ['collective', 'dig', 'dns', 'fleet', 'install', 'irc', 'jabber', \
'jcoll', 'nickcapture', 'probe', 'relay', 'rss', 'udp', 'update', 'upgrade', \
'webserver', 'wikipedia']
config['loglevel'] = 100
enable_logging()
sys.path.insert(0, os.getcwd())
# stop function
def stop(x, y):
os._exit(0)
# register SIGTERM handler to stop
signal.signal(signal.SIGTERM, stop)
try:
users.add('test', ['test@test', ], ['OPER', 'USER', 'QUOTE'])
except Exception, ex:
pass
what = None
try:
what = sys.argv[1]
except IndexError:
pass
try:
if what:
if what == 'net':
names = map(lambda a: a[:-3], glob.glob('tests/*.py'))
tmp = []
for i in names:
for j in nettests:
if j in i:
tmp.append(i)
names = tmp
else:
names = ['tests/%s' % what, ]
suite = unittest.defaultTestLoader.loadTestsFromNames(names)
unittest.TextTestRunner(verbosity=5).run(suite)
else:
names = map(lambda a: a[:-3], glob.glob('tests/*.py'))
tmp = []
for i in names:
got = 1
for j in nettests:
if j in i:
got = 0
if got:
tmp.append(i)
names = tmp
suite = unittest.defaultTestLoader.loadTestsFromNames(names)
unittest.TextTestRunner(verbosity=5).run(suite)
except KeyboardInterrupt:
os._exit(0)
except Exception, ex:
handle_exception()
os._exit(0)
|