You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use REUSE_DB=1 python manage.py test, but test DB for default alias wasn't created, because django_nose-1.1-py2.7.egg/django_nose/runner.py:_should_create_database believes that the database already exists.
I investigated this and saw that connection.cursor() in _should_create_database doesn't raise exception for connection to default DB, which was renamed to test db name.
However, if the connection was closed before calling the connection.cursor(), the exception is raised for nonexistent DBs and isn't raised for the existing (ie the correct behavior).
Perhaps before calling _should_create_database, the connection should be closed, is not it?
Versions:
django==1.4
django_nose==1.1
MySQL_python==1.2.3
Python==2.7.3
OS - Ubuntu x86_64 3.2.0-27-generic
mysql server - percona-server-server-5.5
these changes have fixed the issue:
diff--gita/django_nose/runner.pyb/django_nose/runner.pyindex18df494..a87e07e100644---a/django_nose/runner.py+++b/django_nose/runner.py@@ -276,17+276,10 @@ classNoseTestSuiteRunner(BasicNoseRunner):orig_db_name=connection.settings_dict['NAME']connection.settings_dict['NAME'] =test_db_name+connection.close()
if_should_create_database(connection):
# We're not using _skip_create_test_db, so put the DB name back:connection.settings_dict['NAME'] =orig_db_name--# Since we replaced the connection with the test DB, closing-# the connection will avoid pooling issues with SQLAlchemy. The-# issue is trying to CREATE/DROP the test database using a-# connection to a DB that was established with that test DB.-# MySQLdb doesn't allow it, and SQLAlchemy attempts to reuse-# the existing connection from its pool.-connection.close()
else:
# Reset auto-increment sequences. Apparently, SUMO's tests are# horrid and coupled to certain numbers.
The text was updated successfully, but these errors were encountered:
I tried to use REUSE_DB=1 python manage.py test, but test DB for default alias wasn't created, because django_nose-1.1-py2.7.egg/django_nose/runner.py:_should_create_database believes that the database already exists.
I investigated this and saw that connection.cursor() in _should_create_database doesn't raise exception for connection to default DB, which was renamed to test db name.
However, if the connection was closed before calling the connection.cursor(), the exception is raised for nonexistent DBs and isn't raised for the existing (ie the correct behavior).
Perhaps before calling _should_create_database, the connection should be closed, is not it?
My settings file contains:
Versions:
django==1.4
django_nose==1.1
MySQL_python==1.2.3
Python==2.7.3
OS - Ubuntu x86_64 3.2.0-27-generic
mysql server - percona-server-server-5.5
these changes have fixed the issue:
The text was updated successfully, but these errors were encountered: