Exemple #1
0
def parse_cli(name="MEDS"):
    from meds.cfg import cfg
    from meds.log import loglevel
    opts, args = make_opts(opts_defs)
    cfg.main.args = args
    cfg.main.update(vars(opts))
    if not cfg.main.workdir: cfg.main.workdir = os.path.expanduser("~/.meds")
    if cfg.main.shell: hello(name, **cfg.main)
    loglevel(cfg.main.loglevel, colors=cfg.main.colors)
Exemple #2
0
def parse_cli(name="MEDS", version=__version__, eggs=False, workdir=""):
    from meds.log import loglevel
    from meds.cfg import main
    import meds.core
    opts, args = make_opts(opts_defs)
    cfg = Config(main)
    cfg.name = name
    cfg.args = args
    cfg.update(vars(opts))
    loglevel(cfg.loglevel, colors=cfg.colors)
    if not cfg.workdir: cfg.workdir = os.path.expanduser(workdir or "~/.meds")
    if cfg.scan or eggs:
        for fn in os.listdir(os.getcwd()):
            if fn.endswith(".egg") and fn not in sys.path:
                logging.warn("# load %s" % fn.split()[-1])
                sys.path.insert(0, os.path.abspath(fn))
    meds.core.cfg.update(cfg)
    return cfg
Exemple #3
0
#
#

""" test for all command. """

from meds.scheduler import launcher
from meds.bots.test import TestBot
from meds.log import loglevel
from meds.event import Event
from meds.cfg import cfg
from meds.mods import cmnds

import unittest
import logging

loglevel(cfg.main.loglevel or "error")

cfg.main.workdir = "test.data"
bot = TestBot()
cmnds.init()
events = []

class Test_Cmnd(unittest.TestCase):

    def test_cmnds(self):
        for cmnd in sorted(cmnds.handlers.keys()):
            if cmnd in ["test", "fetcher"]: continue
            event = Event()
            event.txt = cmnd + " arg1" 
            event._bot = bot
            event.origin = "tester@bot"