def teardown(): """ Remove testing configuration file and otherwise clean up. """ with open(os.path.join(OaConfig.homedir, "sql", "eraseexisting.sql")) as f: sql = f.read() print "Removing tables." DB.run_sql(sql)
def setup(): """ Prepare database for testing. """ if not DB.check_safe(): print "Attempt to erase database with data." sys.exit(-1) with open(os.path.join(OaConfig.homedir, "sql", "eraseexisting.sql")) as f: sql = f.read() print "Removing existing tables." DB.run_sql(sql) with open(os.path.join(OaConfig.homedir, "sql", "emptyschema_396.sql")) as f: sql = f.read() DB.run_sql(sql) print "Installed v3.9.6 table structure."
def setup(): """ Prepare database and configuration file for testing """ # Switch us to use a test database test_config = """ """ f = open(TESTINI, "w") f.write(test_config) f.close() global DB from oasis.lib import DB # Do this *after* writing the test ini file. DB.run_sql("SELECT name, value FROM config WHERE name='test_status';")