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
8780 Various unicode unit tests may fail on MySQL, since test database may be created without utf-8 character set Richard Davies nobody "The MySQL installation notes state that the database character set should be utf-8, specified by either ""CREATE DATABASE CHARACTER SET utf8;"" or a database-wide default ""mysqld -C utf8"" or ""default-character-set = utf8""
runtests.py creates a new test database, but does not force the character set to utf8 when it does so.
This means that users configured with a database-wide default of utf8 will find that runtests.py works fine.
However, users who only set this for their working Django database, may find that the new test database has the wrong character set, in which case they will see several tests fail (one example below):
{{{
$ ./runtests.py --settings=SETT_mysql basic
======================================================================
FAIL: Doctest: modeltests.basic.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
File ""/home/elastic/django-dev/trunk3/django/test/_doctest.py"", line 2180, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.basic.models.__test__.API_TESTS
File ""/home/elastic/django-dev/trunk3/tests/modeltests/basic/models.py"", line unknown line number, in API_TESTS
----------------------------------------------------------------------
File ""/home/elastic/django-dev/trunk3/tests/modeltests/basic/models.py"", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
Article.objects.get(pk=a.id).headline
Expected:
u'\u6797\u539f \u3081\u3050\u307f'
Got:
u'?? ???'
----------------------------------------------------------------------
Ran 1 test in 0.149s
FAILED (failures=1)
}}}
The answer is probably for the test framework to force a complete ""CREATE DATABASE CHARACTER SET utf8;"" when it creates the test database when run with the mysql backend." closed Testing framework master invalid richard.davies@… Unreviewed 0 0 0 0