'Creates a test database, prompting the user for confirmation if the
database already exists. Returns the name of the test database created.'

def create_test_db(self, verbosity=1, autoclobber=False):

    if (verbosity >= 1):
        print ("Creating    test    database    '%s'..." % self.connection.alias)
    test_database_name = self._create_test_db(verbosity, autoclobber)
    self.connection.close()
    self.connection.settings_dict['NAME'] = test_database_name
    can_rollback = self._rollback_works()
    self.connection.settings_dict['SUPPORTS_TRANSACTIONS'] = can_rollback
    call_command('syncdb', verbosity=verbosity, interactive=False, database=self.connection.alias, load_initial_data=False)
    call_command('flush', verbosity=verbosity, interactive=False, database=self.connection.alias)
    if settings.CACHE_BACKEND.startswith('db://'):
        from django.core.cache import parse_backend_uri, cache
        from django.db import router
        if router.allow_syncdb(self.connection.alias, cache.cache_model_class):
            (_, cache_name, _) = parse_backend_uri(settings.CACHE_BACKEND)
            call_command('createcachetable', cache_name, database=self.connection.alias)
    cursor = self.connection.cursor()
    return test_database_name
