def create_db(): try: sqlobject.sqlhub.processConnection = \ sqlobject.connectionForURI(RebuilddConfig().get('build', 'database_uri')) from rebuildd.Package import Package from rebuildd.Job import Job from rebuildd.RebuilddLog import Log Package.createTable() Job.createTable() Log.createTable() except Exception, error: print "E: %s" % error return 1
def rebuildd_global_test_setup(): RebuilddConfig(dontparse=True) RebuilddConfig().set('log', 'logs_dir', '/tmp') RebuilddConfig().set('build', 'database_uri', 'sqlite:///tmp/rebuildd-tests.db') RebuilddConfig().set('build', 'max_jobs', '100') RebuilddConfig().set('log', 'file', '/dev/null') RebuilddConfig().set('log', 'mail_failed', '0') RebuilddConfig().set('build', 'build_more_recent', '0') RebuilddConfig().set('log', 'mail_successful', '0') RebuilddConfig().arch = ["alpha", "any"] Rebuildd() try: Package.dropTable(ifExists=True) Job.dropTable(ifExists=True) Log.dropTable(ifExists=True) Package.createTable() Job.createTable() Log.createTable() except: pass