]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
repair fetch after session close for mssql+pyodbc
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Oct 2021 13:48:41 +0000 (09:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Oct 2021 13:48:41 +0000 (09:48 -0400)
this test relies upon a cursor that can do fetchall()
after connection.rollback() was called.

Change-Id: I8c19a67bad97019375671c69d6ed7fa4f4e6872f

test/orm/test_session.py
test/requirements.py

index afd9ca8159b8e605b0b8b835178fe0222558459a..94b35c5b3f79b4a95cc9c671faa46f1c1cadde36 100644 (file)
@@ -2187,7 +2187,10 @@ class NewStyleExecutionTest(_fixtures.FixtureTest):
     def setup_mappers(cls):
         cls._setup_stock_mapping()
 
-    @testing.combinations(("close",), ("expunge_all",))
+    @testing.combinations(
+        ("close", testing.requires.cursor_works_post_rollback),
+        ("expunge_all",),
+    )
     def test_unbuffered_result_session_is_closed(self, meth):
         """test #7128"""
         User = self.classes.User
index 7efd6cbd50da4a289457656281ed4fba619cf416..72129a2d5d1db4eea50a8ff1d8f8c613a8bb427c 100644 (file)
@@ -350,6 +350,18 @@ class DefaultRequirements(SuiteRequirements):
 
         return skip_if(["mssql", "mysql", "mariadb"], "no driver support")
 
+    @property
+    def cursor_works_post_rollback(self):
+        """Driver quirk where the cursor.fetchall() will work even if
+        the connection has been rolled back.
+
+        This generally refers to buffered cursors but also seems to work
+        with cx_oracle, for example.
+
+        """
+
+        return skip_if(["+pyodbc"], "no driver support")
+
     @property
     def independent_connections(self):
         """