(self, *args, **kwargs)
| 44 | call_count = [0] |
| 45 | |
| 46 | def transient_failing_commit(self, *args, **kwargs): |
| 47 | call_count[0] += 1 |
| 48 | if call_count[0] == 1: |
| 49 | # Simulate a network drop or DB disconnect on the first try |
| 50 | raise OperationalError("simulated transient DB disconnect", params={}, orig=Exception()) |
| 51 | return original_commit(self, *args, **kwargs) |
| 52 | |
| 53 | with patch('sqlalchemy.orm.Session.commit', autospec=True, side_effect=transient_failing_commit): |
| 54 | # This will trigger the OperationalError, get caught by _ensure_retryable, and retry successfully. |
nothing calls this directly
no outgoing calls
no test coverage detected