]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- repair some suite tests for firebird
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Dec 2013 18:05:32 +0000 (13:05 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Dec 2013 18:41:21 +0000 (13:41 -0500)
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_insert.py
test/requirements.py

index f89d469eaf1ccb4290fdde2cbef7220d81927a03..b2c921f89737d35d310eea01107456033f821e7c 100644 (file)
@@ -132,6 +132,20 @@ class SuiteRequirements(Requirements):
 
         return exclusions.open()
 
+    @property
+    def fetch_rows_post_commit(self):
+        """target platform will allow cursor.fetchone() to proceed after a
+        COMMIT.
+
+        Typically this refers to an INSERT statement with RETURNING which
+        is invoked within "autocommit".   If the row can be returned
+        after the autocommit, then this rule can be open.
+
+        """
+
+        return exclusions.open()
+
+
     @property
     def empty_inserts(self):
         """target platform supports INSERT with no values, i.e.
index e671eeb7a2f4516e868845e9df06eaac2d1edd2a..6fad82a672e813243032de333f97944f2a692210 100644 (file)
@@ -171,7 +171,8 @@ class ReturningTest(fixtures.TablesTest):
                 Column('data', String(50))
             )
 
-    def test_explicit_returning_pk(self):
+    @requirements.fetch_rows_post_commit
+    def test_explicit_returning_pk_autocommit(self):
         engine = config.db
         table = self.tables.autoinc_pk
         r = engine.execute(
@@ -183,6 +184,19 @@ class ReturningTest(fixtures.TablesTest):
         fetched_pk = config.db.scalar(select([table.c.id]))
         eq_(fetched_pk, pk)
 
+    def test_explicit_returning_pk_no_autocommit(self):
+        engine = config.db
+        table = self.tables.autoinc_pk
+        with engine.begin() as conn:
+            r = conn.execute(
+                table.insert().returning(
+                                table.c.id),
+                data="some data"
+            )
+            pk = r.first()[0]
+        fetched_pk = config.db.scalar(select([table.c.id]))
+        eq_(fetched_pk, pk)
+
     def test_autoincrement_on_insert_implcit_returning(self):
 
         config.db.execute(
index 314b9da455b7851818ffcae254f15164a5bc0785..081ae0e091e81f38894f67ab8e206cfe01af7406 100644 (file)
@@ -124,6 +124,18 @@ class DefaultRequirements(SuiteRequirements):
                 "not supported by database"
             )
 
+    @property
+    def insert_from_select(self):
+        return skip_if(
+                    ["firebird"], "crashes for unknown reason"
+                )
+
+    @property
+    def fetch_rows_post_commit(self):
+        return skip_if(
+                    ["firebird"], "not supported"
+                )
+
     @property
     def binary_comparisons(self):
         """target database/driver can allow BLOB/BINARY fields to be compared
@@ -499,10 +511,10 @@ class DefaultRequirements(SuiteRequirements):
         """target backend supports Decimal() objects using E notation
         to represent very large values."""
 
-        return fails_if(
-                ("sybase+pyodbc", None, None,
+        return skip_if(
+                [("sybase+pyodbc", None, None,
                     "Don't know how do get these values through FreeTDS + Sybase"),
-                ("firebird", None, None, "Precision must be from 1 to 18"),
+                ("firebird", None, None, "Precision must be from 1 to 18"),]
             )
 
     @property