Added supports_select_union skips in queries and aggregation tests.

This commit is contained in:
Tim Graham 2024-08-20 10:29:35 -04:00 committed by nessita
parent cdcd604ef8
commit 6a85c888bf
3 changed files with 7 additions and 1 deletions

View File

@ -2365,6 +2365,7 @@ class AggregateAnnotationPruningTests(TestCase):
).aggregate(count=Count("id", filter=Q(id__in=[F("max_book_author"), 0])))
self.assertEqual(aggregates, {"count": 1})
@skipUnlessDBFeature("supports_select_union")
def test_aggregate_combined_queries(self):
# Combined queries could have members in their values select mask while
# others have them in their annotation mask which makes annotation

View File

@ -19,8 +19,11 @@ class ExplainTests(TestCase):
Tag.objects.filter(name="test").prefetch_related("children"),
Tag.objects.filter(name="test").annotate(Count("children")),
Tag.objects.filter(name="test").values_list("name"),
Tag.objects.order_by().union(Tag.objects.order_by().filter(name="test")),
]
if connection.features.supports_select_union:
querysets.append(
Tag.objects.order_by().union(Tag.objects.order_by().filter(name="test"))
)
if connection.features.has_select_for_update:
querysets.append(Tag.objects.select_for_update().filter(name="test"))
supported_formats = connection.features.supported_explain_formats
@ -96,6 +99,7 @@ class ExplainTests(TestCase):
option = "{} {}".format(name.upper(), "true" if value else "false")
self.assertIn(option, captured_queries[0]["sql"])
@skipUnlessDBFeature("supports_select_union")
def test_multi_page_text_explain(self):
if "TEXT" not in connection.features.supported_explain_formats:
self.skipTest("This backend does not support TEXT format.")

View File

@ -1375,6 +1375,7 @@ class Queries1Tests(TestCase):
self.assertCountEqual(items_after, [self.i2, self.i3, self.i4])
self.assertCountEqual(items_before, items_after)
@skipUnlessDBFeature("supports_select_union")
def test_union_values_subquery(self):
items = Item.objects.filter(creator=OuterRef("pk"))
item_authors = Author.objects.annotate(is_creator=Exists(items)).order_by()