mirror of https://github.com/django/django.git
Fixed #21099 - Skip DistinctOnTests unless backend can_distinct_on_fields
This commit is contained in:
parent
4c5641dd92
commit
018037736f
|
@ -6,6 +6,7 @@ from django.test.utils import str_prefix
|
||||||
|
|
||||||
from .models import Tag, Celebrity, Fan, Staff, StaffTag
|
from .models import Tag, Celebrity, Fan, Staff, StaffTag
|
||||||
|
|
||||||
|
@skipUnlessDBFeature('can_distinct_on_fields')
|
||||||
class DistinctOnTests(TestCase):
|
class DistinctOnTests(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
t1 = Tag.objects.create(name='t1')
|
t1 = Tag.objects.create(name='t1')
|
||||||
|
@ -29,7 +30,6 @@ class DistinctOnTests(TestCase):
|
||||||
self.fan2 = Fan.objects.create(fan_of=celeb1)
|
self.fan2 = Fan.objects.create(fan_of=celeb1)
|
||||||
self.fan3 = Fan.objects.create(fan_of=celeb2)
|
self.fan3 = Fan.objects.create(fan_of=celeb2)
|
||||||
|
|
||||||
@skipUnlessDBFeature('can_distinct_on_fields')
|
|
||||||
def test_basic_distinct_on(self):
|
def test_basic_distinct_on(self):
|
||||||
"""QuerySet.distinct('field', ...) works"""
|
"""QuerySet.distinct('field', ...) works"""
|
||||||
# (qset, expected) tuples
|
# (qset, expected) tuples
|
||||||
|
@ -101,7 +101,6 @@ class DistinctOnTests(TestCase):
|
||||||
c2 = c1.distinct('pk')
|
c2 = c1.distinct('pk')
|
||||||
self.assertNotIn('OUTER JOIN', str(c2.query))
|
self.assertNotIn('OUTER JOIN', str(c2.query))
|
||||||
|
|
||||||
@skipUnlessDBFeature('can_distinct_on_fields')
|
|
||||||
def test_distinct_not_implemented_checks(self):
|
def test_distinct_not_implemented_checks(self):
|
||||||
# distinct + annotate not allowed
|
# distinct + annotate not allowed
|
||||||
with self.assertRaises(NotImplementedError):
|
with self.assertRaises(NotImplementedError):
|
||||||
|
|
Loading…
Reference in New Issue