﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6665	test.utils.create_test_db cannot drop existing test database when using MySQL	Daniel Eloff <dan.eloff@…>	nobody	"If the test database is not removed during the previous test run, then django will try to drop it and recreate it. With MySQL this yields:

Got an error recreating the test database: (1192, ""Can't execute the given command because you have active locked tables or an active transaction"")

I fixed this by closing the connection and creating a new one before the execution of the DROP command.

{{{
connection.close()
from django.db import connection
cursor = connection.cursor()
cursor.execute(""DROP DATABASE %s"" % qn(TEST_DATABASE_NAME))
}}}

Doing this requires adding a ""global connection"" to the top of the create_test_db function.
"		closed	Testing framework	dev		worksforme			Unreviewed	0	0	0	0	0	0
