mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.7.x] Silenced a Python 2 ImportWarning in a migrations test.
Backport of 66211b4b75 from master
			
			
This commit is contained in:
		| @@ -6,6 +6,7 @@ import os | ||||
| import re | ||||
| import tokenize | ||||
| import unittest | ||||
| import warnings | ||||
|  | ||||
| from django.core.validators import RegexValidator, EmailValidator | ||||
| from django.db import models, migrations | ||||
| @@ -272,7 +273,12 @@ class WriterTests(TestCase): | ||||
|                 migration = migrations.Migration('0001_initial', app.split('.')[-1]) | ||||
|                 expected_path = os.path.join(base_dir, *(app.split('.') + ['migrations', '0001_initial.py'])) | ||||
|                 writer = MigrationWriter(migration) | ||||
|                 self.assertEqual(writer.path, expected_path) | ||||
|                 # Silence warning on Python 2: Not importing directory | ||||
|                 # 'tests/migrations/migrations_test_apps/without_init_file/migrations': | ||||
|                 # missing __init__.py | ||||
|                 with warnings.catch_warnings(): | ||||
|                     warnings.filterwarnings("ignore", category=ImportWarning) | ||||
|                     self.assertEqual(writer.path, expected_path) | ||||
|  | ||||
|     def test_custom_operation(self): | ||||
|         migration = type(str("Migration"), (migrations.Migration,), { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user