示例#1
0
    def setUpClass(cls):
        from sqlalchemy import create_engine

        try:
            cls.db_url = config["db"]["url"]
        except KeyError:
            cls.db_url = "sqlite://"
        cls.engine = create_engine(cls.db_url)

        if not "backend" in cache.__dict__:
            cache.configure("null")
示例#2
0
def main(argv=sys.argv):
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    import augias.tests  # for the null cache backend
    from augias.utils import cache
    cache.configure('null')
    with transaction.manager:
        user = get_user('*****@*****.**')
        for t in DBSession.query(Task).all():
            if random.random() < 0.2:
                t.last_execution = None
            else:
                exec_time = datetime.datetime.now() - datetime.timedelta(days=t.periodicity * random.random() * 1.5)
                t.execute(user, 10, exec_time)