Commits

Mike Mazur committed 207ff05

Flush all databases

Comments (0)

Files changed (1)

nosedjango/nosedjango.py

     def setup_single_test_db(self, settings):
         from django.db import connection
         self.old_db = settings.DATABASE_NAME
+        self.db_names = [settings.DATABASE_NAME]
         connection.creation.create_test_db(verbosity=self.verbosity)
 
     def setup_multi_test_db(self, settings):
         from django.db import connections
         old_names = []
         mirrors = []
+        self.db_names = []
         for alias in connections:
             connection = connections[alias]
+            self.db_names.append(alias)
             # If the database is a test mirror, redirect it's connection
             # instead of creating a test database.
             if connection.settings_dict['TEST_MIRROR']:
         from django.core.management import call_command
         from django.core.urlresolvers import clear_url_caches
         from django.conf import settings
-        call_command('flush', verbosity=0, interactive=False)
+        for db_name in self.db_names:
+            call_command('flush', verbosity=0, interactive=False,
+                    **{'database': db_name})
 
         if isinstance(test, nose.case.Test) and \
             isinstance(test.test, nose.case.MethodTestCase) and \