diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py index 8a07e0c417d8..d57bf9ee1fa7 100644 --- a/django/db/backends/sqlite3/creation.py +++ b/django/db/backends/sqlite3/creation.py @@ -155,5 +155,3 @@ def setup_worker_connection(self, _worker_id): # connection. self.connection.connect() target_db.close() - if os.environ.get("RUNNING_DJANGOS_TEST_SUITE") == "true": - self.mark_expected_failures_and_skips() diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 8f9349e7ebbf..84950d4ec069 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -2346,13 +2346,7 @@ def clear_ordering(self, force=False, clear_default=True): query (not even the model's default). """ if not force and ( - self.is_sliced - or self.distinct_fields - or self.select_for_update - or ( - isinstance(self.group_by, tuple) - and not {*self.order_by, *self.extra_order_by}.issubset(self.group_by) - ) + self.is_sliced or self.distinct_fields or self.select_for_update ): return self.order_by = () diff --git a/django/test/runner.py b/django/test/runner.py index 41c9dbd10ca9..d0367ba71eb8 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -473,6 +473,11 @@ def _init_worker( if value := serialized_contents.get(alias): connection._test_serialized_contents = value connection.creation.setup_worker_connection(_worker_id) + if ( + is_spawn_or_forkserver + and os.environ.get("RUNNING_DJANGOS_TEST_SUITE") == "true" + ): + connection.creation.mark_expected_failures_and_skips() if is_spawn_or_forkserver: call_command( diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 5f17169dc66f..3e1a6a71f9ea 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -171,25 +171,6 @@ def assertObjectAttrs(self, obj, **kwargs): for attr, value in kwargs.items(): self.assertEqual(getattr(obj, attr), value) - def test_count_preserve_group_by(self): - # new release of the same book - Book.objects.create( - isbn="113235613", - name=self.b4.name, - pages=self.b4.pages, - rating=4.0, - price=Decimal("39.69"), - contact=self.a5, - publisher=self.p3, - pubdate=datetime.date(2018, 11, 3), - ) - qs = Book.objects.values("contact__name", "publisher__name").annotate( - publications=Count("id") - ) - self.assertEqual(qs.count(), Book.objects.count() - 1) - self.assertEqual(qs.order_by("id").count(), Book.objects.count()) - self.assertEqual(qs.extra(order_by=["id"]).count(), Book.objects.count()) - def test_annotation_with_value(self): values = ( Book.objects.filter(