From 66211b4b75a93c15f4914e698cf58d48b73a2fe0 Mon Sep 17 00:00:00 2001
From: Tim Graham <timograham@gmail.com>
Date: Thu, 24 Jul 2014 09:24:52 -0400
Subject: [PATCH] Silenced a Python 2 ImportWarning in a migrations test.

---
 tests/migrations/test_writer.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index 539c201a97..64368af03e 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -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,), {