Esempio n. 1
0
def class_refresh_db(dump_file_path):
    """
    This fixture rolls the DB back to the previous state when the class is
    finished; to be used on classes that alter data.

    Use like:

        @pytest.mark.usefixtures('class_refresh_db', 'testdb')
        class MyClass(AcceptanceHelper):
    """
    global class_refresh_db_durations
    yield
    if 'NO_CLASS_REFRESH_DB' in os.environ:
        return
    logger.info('Refreshing DB (class-scoped)')
    s = time()
    restore_mysqldump(dump_file_path, get_db_engine())
    class_refresh_db_durations.append(time() - s)
Esempio n. 2
0
 def test_0_clean_db(self, dump_file_path):
     # clean the database; empty schema
     restore_mysqldump(dump_file_path, engine, with_data=False)