mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Applied ignore_warnings to Django tests
This commit is contained in:
@@ -7,12 +7,11 @@ import os
|
||||
import re
|
||||
import tokenize
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from django.core.validators import RegexValidator, EmailValidator
|
||||
from django.db import models, migrations
|
||||
from django.db.migrations.writer import MigrationWriter, SettingsReference
|
||||
from django.test import TestCase
|
||||
from django.test import TestCase, ignore_warnings
|
||||
from django.conf import settings
|
||||
from django.utils import datetime_safe, six
|
||||
from django.utils.deconstruct import deconstructible
|
||||
@@ -288,6 +287,10 @@ class WriterTests(TestCase):
|
||||
)
|
||||
)
|
||||
|
||||
# Silence warning on Python 2: Not importing directory
|
||||
# 'tests/migrations/migrations_test_apps/without_init_file/migrations':
|
||||
# missing __init__.py
|
||||
@ignore_warnings(category=ImportWarning)
|
||||
def test_migration_path(self):
|
||||
test_apps = [
|
||||
'migrations.migrations_test_apps.normal',
|
||||
@@ -302,12 +305,7 @@ 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)
|
||||
# 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)
|
||||
self.assertEqual(writer.path, expected_path)
|
||||
|
||||
def test_custom_operation(self):
|
||||
migration = type(str("Migration"), (migrations.Migration,), {
|
||||
|
||||
Reference in New Issue
Block a user