Skip to content

Commit

Permalink
Added printing of the name of test database being created/destroyed, …
Browse files Browse the repository at this point in the history
…at verbosity level 2. Refs #14415.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14666 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
ramiro committed Nov 21, 2010
1 parent 6774207 commit 752bd8b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions django/db/backends/creation.py
Expand Up @@ -340,11 +340,14 @@ def create_test_db(self, verbosity=1, autoclobber=False):
Creates a test database, prompting the user for confirmation if the Creates a test database, prompting the user for confirmation if the
database already exists. Returns the name of the test database created. database already exists. Returns the name of the test database created.
""" """
if verbosity >= 1:
print "Creating test database '%s'..." % self.connection.alias

test_database_name = self._create_test_db(verbosity, autoclobber) test_database_name = self._create_test_db(verbosity, autoclobber)


if verbosity >= 1:
test_db_repr = ''
if verbosity >= 2:
test_db_repr = " ('%s')" % test_database_name
print "Creating test database for alias '%s'%s..." % (self.connection.alias, test_db_repr)

self.connection.close() self.connection.close()
self.connection.settings_dict["NAME"] = test_database_name self.connection.settings_dict["NAME"] = test_database_name


Expand Down Expand Up @@ -411,10 +414,13 @@ def destroy_test_db(self, old_database_name, verbosity=1):
Destroy a test database, prompting the user for confirmation if the Destroy a test database, prompting the user for confirmation if the
database already exists. Returns the name of the test database created. database already exists. Returns the name of the test database created.
""" """
if verbosity >= 1:
print "Destroying test database '%s'..." % self.connection.alias
self.connection.close() self.connection.close()
test_database_name = self.connection.settings_dict['NAME'] test_database_name = self.connection.settings_dict['NAME']
if verbosity >= 1:
test_db_repr = ''
if verbosity >= 2:
test_db_repr = " ('%s')" % test_database_name
print "Destroying test database for alias '%s'%s..." % (self.connection.alias, test_db_repr)
self.connection.settings_dict['NAME'] = old_database_name self.connection.settings_dict['NAME'] = old_database_name


self._destroy_test_db(test_database_name, verbosity) self._destroy_test_db(test_database_name, verbosity)
Expand Down

0 comments on commit 752bd8b

Please sign in to comment.