#22584: Test always fail with the Django backend from MySQL Connector/Python
---------------------------------+------------------------
Reporter: giuliettamasina | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/22584>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/058.eabda58a02e4b2ad45ce4fad1ce39526%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.