#NEWLINE# def setup_databases( self ) : #NEWLINE# #INDENT# 'Setup databases, skipping DB creation if requested and possible.' #NEWLINE# for alias in connections : #NEWLINE# #INDENT# connection = connections [ alias ] #NEWLINE# creation = connection . creation #NEWLINE# test_db_name = creation . _get_test_db_name ( ) #NEWLINE# orig_db_name = connection . settings_dict [ 'NAME' ] #NEWLINE# connection . settings_dict [ 'NAME' ] = test_db_name #NEWLINE# if _should_create_database ( connection ) : #NEWLINE# #INDENT# connection . settings_dict [ 'NAME' ] = orig_db_name #NEWLINE# connection . close ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cursor = connection . cursor ( ) #NEWLINE# style = no_style ( ) #NEWLINE# if uses_mysql ( connection ) : #NEWLINE# #INDENT# reset_statements = _mysql_reset_sequences ( style , connection ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reset_statements = connection . ops . sequence_reset_sql ( style , self . _get_models_for_connection ( connection ) ) #NEWLINE# #UNINDENT# if hasattr ( transaction , 'atomic' ) : #NEWLINE# #INDENT# with transaction . atomic ( using = connection . alias ) : #NEWLINE# #INDENT# for reset_statement in cursor : #NEWLINE# #INDENT# cursor . execute ( reset_statement ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for reset_statement in reset_statements : #NEWLINE# #INDENT# cursor . execute ( reset_statement ) #NEWLINE# #UNINDENT# transaction . commit_unless_managed ( using = connection . alias ) #NEWLINE# #UNINDENT# creation . create_test_db = MethodType ( _skip_create_test_db , creation ) #NEWLINE# #UNINDENT# #UNINDENT# Command . handle = _foreign_key_ignoring_handle #NEWLINE# return super ( NoseTestSuiteRunner , self ) . setup_databases ( )