vatsrahul1001 commented on code in PR #74861:
URL: https://github.com/apache/airflow/pull/74861#discussion_r4296815597
##########
airflow-core/tests/unit/utils/test_sqlalchemy.py:
##########
@@ -219,6 +219,20 @@ def test_prohibit_commit_specific_session_only(self):
other_session.execute(text("SELECT 1"))
other_session.commit()
+ def test_prohibit_commit_allows_savepoint_release(self):
+ """A SAVEPOINT release (session.begin_nested()) dispatches the same
before_commit
+ event as a real commit, but must not trip the guard: it ends neither
the outer
+ transaction nor its row locks."""
+ with prohibit_commit(self.session):
+ self.session.execute(text("SELECT 1"))
+ with self.session.begin_nested():
+ self.session.execute(text("SELECT 1"))
+
+ # The guard must still catch a real commit after the savepoint
released.
+ with pytest.raises(RuntimeError, match="UNEXPECTED COMMIT"):
+ self.session.commit()
+ self.session.rollback()
Review Comment:
Added — now also asserts a real commit still raises while inside an open
savepoint (not just after it releases).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]