#!/usr/bin/env python
# coding=utf-8

"""sanity check for {{name}}

"""

import sys
import logging

from yygame.utils import check

from {{name}}.config import CONF
# from {{name}} import db

logger = logging.getLogger(__name__)


@check
def check_dumb():
    return True


# @check
# def check_db():
#     with db.get_cursor() as cur:
#         cur.execute(u"""\
# SELECT 1
# """)
#         return cur.fetchone()[0] == 1


def main():
    results = [
        check_dumb(),
        # check_db(),
    ]
    pass_count = len([x for x in results if x])
    fail_count = len(results) - pass_count
    if fail_count:
        logger.error("%s checks passed, %s failed.",
                     pass_count, fail_count)
        sys.exit(fail_count)
    else:
        logger.info("%s checks passed.", pass_count)


if __name__ == '__main__':
    main()
