-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore(django-spanner): disable savepoints and remove can_rollback_tests #16866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): | |
| # Spanner does not support SELECTing an arbitrary expression that also | ||
| # appears in the GROUP BY clause. | ||
| supports_subqueries_in_group_by = False | ||
| uses_savepoints = True | ||
| uses_savepoints = False # Spanner does not support savepoints. | ||
| can_rollback_tests = False # Spanner savepoints are no-ops; rely on flush. | ||
| supports_aggregate_filter_clause = False | ||
| # Spanner does not support expression indexes | ||
|
|
@@ -274,6 +274,18 @@ class DatabaseFeatures(BaseDatabaseFeatures): | |
| if os.environ.get("SPANNER_EMULATOR_HOST", None): | ||
| # Some code isn't yet supported by the Spanner emulator. | ||
| skip_tests += ( | ||
| "fixtures_model_package.tests.FixtureTestCase.test_loaddata", | ||
| "transaction_hooks.tests.TestConnectionOnCommit.test_inner_savepoint_does_not_affect_outer", | ||
| "model_fields.test_floatfield.TestFloatField.test_float_validates_object", | ||
| "model_fields.tests.GetChoicesOrderingTests.test_get_choices_reverse_related_field", | ||
| "sessions_tests.tests.CacheDBSessionTests.test_session_asave_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.CacheDBSessionTests.test_session_save_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.CacheDBSessionWithTimeZoneTests.test_session_asave_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.CacheDBSessionWithTimeZoneTests.test_session_save_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.CustomDatabaseSessionTests.test_session_asave_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.CustomDatabaseSessionTests.test_session_save_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.DatabaseSessionTests.test_session_asave_does_not_resurrect_session_logged_out_in_other_context", | ||
| "sessions_tests.tests.DatabaseSessionTests.test_session_save_does_not_resurrect_session_logged_out_in_other_context", | ||
|
Comment on lines
+277
to
+288
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests are designed to simulate expected failures within a transaction and rely on savepoints to recover and continue execution. Because we have disabled savepoints (uses_savepoints = False) for production safety, and Cloud Spanner breaks the entire transaction upon encountering any error, these tests are unable to recover and fail with TransactionManagementError. They have been skipped on the emulator as they are fundamentally incompatible with Spanner's transaction model without native savepoint support. These were passing previously because when |
||
| # Data Leakage / Test Isolation Issues (Spanner Emulator Limitation) | ||
| "model_inheritance.tests.ModelInheritanceDataTests.test_update_query_counts", | ||
| "model_inheritance.tests.ModelInheritanceTests.test_create_child_no_update", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this value still correct? The comment is at least now outdated, as we explicitly turn off savepoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this line if we plan to stop supporting versions 5.0/5.1. This is dead code for Django >=5.2.