From: Mike Bayer Date: Fri, 18 Aug 2017 17:04:14 +0000 (-0400) Subject: First level repair for cx_Oracle 6.0 test regressions X-Git-Tag: rel_1_1_14~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53175850bf1e238b968adf025d8de6ac28d6203c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git First level repair for cx_Oracle 6.0 test regressions Fixed more regressions caused by cx_Oracle 6.0; at the moment, the only behavioral change for users is disconnect detection now detects for cx_Oracle.DatabaseError in addition to cx_Oracle.InterfaceError, as this behavior seems to have changed. Other issues regarding numeric precision and uncloseable connections are pending with the upstream cx_Oracle issue tracker. Change-Id: Id61f1e33b21c155a598396340dfdecd28ff4066b Fixes: #4045 (cherry picked from commit 03255a5a0fc6aa8acfff99ed9e62d58054b8b6af) --- diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index cc5a22fc05..2578ec0d65 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -858,6 +858,7 @@ class OracleDialect_cx_oracle(OracleDialect): size, precision, scale): # convert all NUMBER with precision + positive scale to Decimal # this almost allows "native decimal" mode. + if self.supports_native_decimal and \ defaultType == cx_Oracle.NUMBER and \ precision and scale > 0: @@ -966,7 +967,8 @@ class OracleDialect_cx_oracle(OracleDialect): def is_disconnect(self, e, connection, cursor): error, = e.args - if isinstance(e, self.dbapi.InterfaceError): + if isinstance(e, ( + self.dbapi.InterfaceError, self.dbapi.DatabaseError)): return "not connected" in str(e) elif hasattr(error, 'code'): # ORA-00028: your session has been killed diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py index db70436e06..e254752091 100644 --- a/test/engine/test_reconnect.py +++ b/test/engine/test_reconnect.py @@ -858,6 +858,9 @@ class InvalidateDuringResultTest(fixtures.TestBase): self.meta.drop_all() self.engine.dispose() + @testing.crashes( + "oracle", + "cx_oracle 6 doesn't allow a close like this due to open cursors") @testing.fails_if([ '+mysqlconnector', '+mysqldb', '+cymysql', '+pymysql', '+pg8000'], "Buffers the result set and doesn't check for connection close") diff --git a/test/requirements.py b/test/requirements.py index d43434095b..58ba0bc184 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -697,8 +697,13 @@ class DefaultRequirements(SuiteRequirements): such as 319438950232418390.273596, 87673.594069654243 """ + def cx_oracle_6_config(config): + return config.db.driver == "cx_oracle" and \ + config.db.dialect.cx_oracle_ver >= (6, ) + return fails_if( - [('sqlite', None, None, 'TODO'), + [cx_oracle_6_config, + ('sqlite', None, None, 'TODO'), ("firebird", None, None, "Precision must be from 1 to 18"), ("sybase+pysybase", None, None, "TODO"), ('mssql+pymssql', None, None,