diff options
| author | Tim Graham <timograham@gmail.com> | 2014-07-24 09:24:52 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-07-24 09:29:45 -0400 |
| commit | c86b9d198598b735ba203a56b449cd80516abfef (patch) | |
| tree | 94a5e7665d97e952fe75aee6c4e9ac1d78a74c84 | |
| parent | 7cbb4f79d1e3f1690fb31b118f47590d9470b59b (diff) | |
[1.7.x] Silenced a Python 2 ImportWarning in a migrations test.
Backport of 66211b4b75 from master
| -rw-r--r-- | tests/migrations/test_writer.py | 8 |
1 files changed, 7 insertions, 1 deletions
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,), { |
