Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose_views: Add `savepoint=False` to avoid creating savepoints.
Prakhar Pratyush0e67e4f1a144
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 8321bc651da..46c8eb6ef9a 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -9,6 +9,7 @@ from unittest import mockimport orjsonfrom django.conf import settingsfrom django.core.exceptions import ValidationError+from django.db import transactionfrom django.http import HttpResponsefrom django.utils.timezone import now as timezone_nowfrom typing_extensions import override@@ -4016,7 +4017,9 @@ class SubscriptionRestApiTest(ZulipTestCase):def thunk2() -> HttpResponse:raise JsonableError("random failure")- with self.assertRaises(JsonableError):+ with transaction.atomic(), self.assertRaises(JsonableError):+ # The atomic() wrapper helps to avoid JsonableError breaking+ # the test's transaction.compose_views([thunk1, thunk2])user_profile = self.example_user("hamlet")diff --git a/zerver/transaction_tests/test_user_groups.py b/zerver/transaction_tests/test_user_groups.pyindex 3b5f6be3250..1cdeff32ec1 100644--- a/zerver/transaction_tests/test_user_groups.py+++ b/zerver/transaction_tests/test_user_groups.py@@ -28,7 +28,6 @@ def dev_update_subgroups(assert BARRIER is not Nonetry:with (- transaction.atomic(),mock.patch("zerver.lib.user_groups.access_user_group_for_update") as m,):diff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex d618d473e55..6f0246cba5b 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -468,7 +468,7 @@ def compose_views(thunks: list[Callable[[], HttpResponse]]) -> dict[str, Any]:"""json_dict: dict[str, Any] = {}- with transaction.atomic():+ with transaction.atomic(savepoint=False):for thunk in thunks:response = thunk()json_dict.update(orjson.loads(response.content))diff --git a/zerver/views/user_groups.py b/zerver/views/user_groups.pyindex 2f44c2be18c..98e0d0bf642 100644--- a/zerver/views/user_groups.py+++ b/zerver/views/user_groups.py@@ -468,6 +468,7 @@ def remove_subgroups_from_group_backend(@require_member_or_admin@typed_endpoint[email protected](durable=True)def update_subgroups_of_user_group(request: HttpRequest,user_profile: UserProfile,