Test DB should always be utf-8

RESOLVED FIXED

Status

addons.mozilla.org Graveyard
Code Quality
RESOLVED FIXED
9 years ago
3 years ago

People

(Reporter: wenzel, Unassigned)

Tracking

Details

(Whiteboard: [z])

(Reporter)

Description

9 years ago
We recently added some unicode to our test fixtures, which promptly breaks MySQL (don't get me started on their defaulting to latin1 and a Swedish collation) unless it's manually configured to do utf-8 by default.

After test_utils can handle it (http://github.com/jbalogh/test-utils/issues/issue/1), we should default our test DBs to utf-8 by adding this to the settings file:

diff --git a/settings.py b/settings.py
index b73540e..3090857 100644
--- a/settings.py
+++ b/settings.py
@@ -34,6 +34,8 @@ DATABASES = {
         'USER': '',
         'PASSWORD': '',
         'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
+        'TEST_CHARSET': 'utf8',
+        'TEST_COLLATION': 'utf8_general_ci',
     },
 }
Since we fully override DATABASES in settings_local, putting it in settings.py only helps as documentation.
(Reporter)

Comment 2

9 years ago
 (In reply to comment #1)
> Since we fully override DATABASES in settings_local, putting it in settings.py
> only helps as documentation.

That's fine -- those who don't have that problem won't need to bother. But if utf-8 problems do show up, you'll inevitably have to take care of it :)
(Reporter)

Comment 3

8 years ago
This is fixed as suggested in comment 0.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Updated

3 years ago
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.