mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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.)
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| from __future__ import unicode_literals | from __future__ import unicode_literals | ||||||
|  |  | ||||||
|  | import codecs | ||||||
| import copy | import copy | ||||||
| import os | import os | ||||||
| import shutil | import shutil | ||||||
| @@ -143,8 +144,8 @@ class MakeMigrationsTests(MigrationTestBase): | |||||||
|         # Check for existing 0001_initial.py file in migration folder |         # Check for existing 0001_initial.py file in migration folder | ||||||
|         self.assertTrue(os.path.exists(initial_file)) |         self.assertTrue(os.path.exists(initial_file)) | ||||||
|  |  | ||||||
|         with open(initial_file, 'r') as fp: |         with codecs.open(initial_file, 'r', encoding='utf-8') as fp: | ||||||
|             content = force_text(fp.read()) |             content = fp.read() | ||||||
|             self.assertTrue('# encoding: utf8' in content) |             self.assertTrue('# encoding: utf8' in content) | ||||||
|             self.assertTrue('migrations.CreateModel' in content) |             self.assertTrue('migrations.CreateModel' in content) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user