def tearDownClass(cls): con = cls.driver.connect(host=ENV.host, port=ENV.port, auth_mechanism=ENV.auth_mech) cur = con.cursor() force_drop_database(cur, tmp_db) cur.close() con.close()
def con(host, port, auth_mech, tmp_db): # create the temporary database con = connect(host=host, port=port, auth_mechanism=auth_mech) cur = con.cursor() cur.execute("CREATE DATABASE {0}".format(tmp_db)) cur.close() con.close() # create the actual fixture con = connect(host=host, port=port, auth_mechanism=auth_mech, database=tmp_db) yield con con.close() # cleanup the temporary database con = connect(host=host, port=port, auth_mechanism=auth_mech) cur = con.cursor() force_drop_database(cur, tmp_db) cur.close() con.close()
def con(host, port, auth_mech, tmp_db): # create the temporary database con = connect(host=host, port=port, auth_mechanism=auth_mech) cur = con.cursor() cur.execute('CREATE DATABASE {0}'.format(tmp_db)) cur.close() con.close() # create the actual fixture con = connect(host=host, port=port, auth_mechanism=auth_mech, database=tmp_db) yield con con.close() # cleanup the temporary database con = connect(host=host, port=port, auth_mechanism=auth_mech) cur = con.cursor() force_drop_database(cur, tmp_db) cur.close() con.close()