﻿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
22584	Tests always fail with the Django backend from MySQL Connector/Python	Markus Amalthea Magnuson	nobody	"I'm running a Django 1.7b3 project with a MySQL database using the Django backend from the [http://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html MySQL Connector] from Oracle, as advised in the [https://docs.djangoproject.com/en/1.7/ref/databases/#mysql-db-api-drivers Django docs if running Python 3].

With this setup, running `manage.py test` will always fail with this error:

{{{
<snip>
    File ""/Users/markus/.virtualenvs/clown/lib/python3.4/site-packages/mysql/connector/django/creation.py"", line 50, in sql_table_creation_suffix
        if self.connection.settings_dict['TEST_CHARSET']:
KeyError: 'TEST_CHARSET'
}}}

This is due to the fact the the various `TEST_` settings have finally been [https://docs.djangoproject.com/en/1.7/ref/settings/#test-charset deprecated in Django 1.7], but the connector assumes these exist. The error is caused specifically by this method in `connector/django/creation.py`:

{{{
def sql_table_creation_suffix(self):
    suffix = []
    if self.connection.settings_dict['TEST_CHARSET']:
        suffix.append('CHARACTER SET {0}'.format(
            self.connection.settings_dict['TEST_CHARSET']))
    if self.connection.settings_dict['TEST_COLLATION']:
        suffix.append('COLLATE {0}'.format(
            self.connection.settings_dict['TEST_COLLATION']))
    return ' '.join(suffix)
}}}

I'm not sure what the immediate solution is other than using Django's built-in MySQL backend. Why is this not the recommended way in the documentation? Does it not (yet) support Python 3?

Who knows when Oracle will fix this on their side, the problem persists in their [http://dev.mysql.com/downloads/connector/python/1.2.html latest dev release (1.2.1 rc)] of the Python connector."	Uncategorized	closed	Uncategorized	1.7-beta-2	Normal	invalid			Unreviewed	0	0	0	0	0	0
