mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Applied ignore_warnings to Django tests
This commit is contained in:
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
||||
import datetime
|
||||
from decimal import Decimal
|
||||
import re
|
||||
import warnings
|
||||
|
||||
from django.core.exceptions import FieldError
|
||||
from django.db import connection
|
||||
@@ -11,10 +10,7 @@ from django.db.models import (
|
||||
Avg, Sum, Count, Max, Min,
|
||||
Aggregate, F, Value, Func,
|
||||
IntegerField, FloatField, DecimalField)
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
from django.db.models.sql import aggregates as sql_aggregates
|
||||
from django.test import TestCase
|
||||
from django.test import TestCase, ignore_warnings
|
||||
from django.test.utils import Approximate
|
||||
from django.test.utils import CaptureQueriesContext
|
||||
from django.utils import six, timezone
|
||||
@@ -950,7 +946,9 @@ class ComplexAggregateTestCase(TestCase):
|
||||
self.assertQuerysetEqual(
|
||||
qs2, [1, 2], lambda v: v.pk)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_backwards_compatibility(self):
|
||||
from django.db.models.sql import aggregates as sql_aggregates
|
||||
|
||||
class SqlNewSum(sql_aggregates.Aggregate):
|
||||
sql_function = 'SUM'
|
||||
@@ -964,8 +962,6 @@ class ComplexAggregateTestCase(TestCase):
|
||||
col, source=source, is_summary=is_summary, **self.extra)
|
||||
query.annotations[alias] = aggregate
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", RemovedInDjango20Warning)
|
||||
qs = Author.objects.values('name').annotate(another_age=NewSum('age') + F('age'))
|
||||
a = qs.get(pk=1)
|
||||
self.assertEqual(a['another_age'], 68)
|
||||
qs = Author.objects.values('name').annotate(another_age=NewSum('age') + F('age'))
|
||||
a = qs.get(pk=1)
|
||||
self.assertEqual(a['another_age'], 68)
|
||||
|
||||
Reference in New Issue
Block a user