Esempio n. 1
0
 def __init__(self, dbname=None):
     """
     Takes a filename for the database and will create it and any required
     tables if the database filename doesnt exist.
     """
     Console.__init__(self)
     self.colormap = dict(Cval=Fore.YELLOW,
                          Csym=Fore.GREEN,
                          Ckey=Fore.CYAN,
                          Cres=Style.RESET_ALL)
     self.prompt = "{Csym}[{Ckey}HOME{Csym}]>{Cres}".format(**self.colormap)
     dbname = "library.lbr" if dbname is None else dbname
     self.library = Library(dbname)
     if not os.path.exists(dbname):
         self.library.create_db()
     self.list_max = 50
Esempio n. 2
0
def main(clargs=None):
    """Command line entry point."""
    from argparse import ArgumentParser
    from librarian.library import Library
    import sys

    parser = ArgumentParser(
        description="A test runner for each card in a librarian library.")
    parser.add_argument("library", help="Library database")
    parser.add_argument("-t",
                        "--tests",
                        default="test/",
                        help="Test directory")
    args = parser.parse_args(clargs)

    descovery(args.tests)

    library = Library(args.library)
    cardcount, passes, failures = execute_tests(library)
    print(RESULTS.format(len(SINGLES), len(TESTS), cardcount, passes,
                         failures))
    sys.exit(failures)