From 6a85c888bff84134ed674ddfef935e0a9906fc9f Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 20 Aug 2024 10:29:35 -0400 Subject: [PATCH] Added supports_select_union skips in queries and aggregation tests. --- tests/aggregation/tests.py | 1 + tests/queries/test_explain.py | 6 +++++- tests/queries/tests.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index a5914f1878..b6ba728e77 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -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 diff --git a/tests/queries/test_explain.py b/tests/queries/test_explain.py index 44689aedf8..67440cb502 100644 --- a/tests/queries/test_explain.py +++ b/tests/queries/test_explain.py @@ -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.") diff --git a/tests/queries/tests.py b/tests/queries/tests.py index ec88fa558d..45866fd50f 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -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()