From 0cba61d150b84646f8da02cff66e25e9542f92a6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 27 Dec 2013 13:05:32 -0500 Subject: [PATCH] - repair some suite tests for firebird --- lib/sqlalchemy/testing/requirements.py | 14 ++++++++++++++ lib/sqlalchemy/testing/suite/test_insert.py | 16 +++++++++++++++- test/requirements.py | 18 +++++++++++++++--- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index e48fa2c004..3e48ba026e 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -138,6 +138,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. diff --git a/lib/sqlalchemy/testing/suite/test_insert.py b/lib/sqlalchemy/testing/suite/test_insert.py index 21141f244d..deda63b248 100644 --- a/lib/sqlalchemy/testing/suite/test_insert.py +++ b/lib/sqlalchemy/testing/suite/test_insert.py @@ -172,7 +172,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( @@ -184,6 +185,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( diff --git a/test/requirements.py b/test/requirements.py index b6fca06edc..f7b53d8dfe 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -122,6 +122,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 @@ -503,10 +515,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 -- 2.47.3