summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Morales <ramiro@rmorales.net>2013-10-27 14:51:40 -0300
committerRamiro Morales <ramiro@rmorales.net>2013-10-27 14:54:56 -0300
commit88f03db05fb3c42648289fa6ed27d6c13e2719cb (patch)
treeca6b087121f6bbf6546ad7dbc7b775f3faa794f8
parent78bc96caf52430a24540354ef34496f8823685b2 (diff)
Fixed test that reads a migration file from disk.
We need to make sure content read from the file is decoded from UTF-8 right from the start so Python doesn't try to use another encoding (read: ASCII/CP1252 under Windows.)
-rw-r--r--tests/migrations/test_commands.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index eac6fd90b9..dbed522dd5 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+import codecs
import copy
import os
import shutil
@@ -143,8 +144,8 @@ class MakeMigrationsTests(MigrationTestBase):
# Check for existing 0001_initial.py file in migration folder
self.assertTrue(os.path.exists(initial_file))
- with open(initial_file, 'r') as fp:
- content = force_text(fp.read())
+ with codecs.open(initial_file, 'r', encoding='utf-8') as fp:
+ content = fp.read()
self.assertTrue('# encoding: utf8' in content)
self.assertTrue('migrations.CreateModel' in content)