Пример #1
0
def dropTestDatabase(dropModels=True):
    """
    Call this to clear all contents from the test database. Also forces models
    to reload.
    """
    db_connection = getDbConnection()

    dbName = cherrypy.config['database']['uri'].split('/')[-1]

    if 'girder_test_' not in dbName:
        raise Exception('Expected a testing database name, but got %s' % dbName)
    db_connection.drop_database(dbName)

    if dropModels:
        model_importer.reinitializeAll()
Пример #2
0
def dropTestDatabase(dropModels=True):
    """
    Call this to clear all contents from the test database. Also forces models
    to reload.
    """
    db_connection = getDbConnection()

    dbName = cherrypy.config['database']['uri'].split('/')[-1]

    if 'girder_test_' not in dbName:
        raise Exception('Expected a testing database name, but got %s' % dbName)
    db_connection.drop_database(dbName)

    if dropModels:
        model_importer.reinitializeAll()
Пример #3
0
def dropTestDatabase(dropModels=True):
    """
    Call this to clear all contents from the test database. Also forces models
    to reload.
    """
    db_connection = getDbConnection()

    dbName = cherrypy.config['database']['uri'].split('/')[-1]

    if 'girder_test_' not in dbName:
        raise Exception('Expected a testing database name, but got %s' % dbName)
    if dbName in db_connection.database_names():
        if dbName not in usedDBs and 'newdb' in os.environ.get('EXTRADEBUG', '').split():
            raise Exception('Warning: database %s already exists' % dbName)
        db_connection.drop_database(dbName)
    usedDBs[dbName] = True
    if dropModels:
        model_importer.reinitializeAll()
Пример #4
0
def dropTestDatabase(dropModels=True):
    """
    Call this to clear all contents from the test database. Also forces models
    to reload.
    """
    db_connection = getDbConnection()

    dbName = cherrypy.config['database']['uri'].split('/')[-1]

    if 'girder_test_' not in dbName:
        raise Exception('Expected a testing database name, but got %s' % dbName)
    if dbName in db_connection.database_names():
        if dbName not in usedDBs and 'newdb' in os.environ.get('EXTRADEBUG', '').split():
            raise Exception('Warning: database %s already exists' % dbName)
        db_connection.drop_database(dbName)
    usedDBs[dbName] = True
    if dropModels:
        model_importer.reinitializeAll()