From: Mike Bayer Date: Wed, 22 Mar 2017 14:13:15 +0000 (-0400) Subject: Use config.db global opts as defaults for all testing_engine() X-Git-Tag: rel_1_2_0b1~138 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28edc2604a96d5ecd8318232c95a034433aa07d1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Use config.db global opts as defaults for all testing_engine() Some options need to be passed to engines in all cases, such as currently the oracle 12516 workaround. make sure calls to testing_engine also set up the dictionary with defaults even if options is passed. not clear if this affects other backends yet. Change-Id: I5a1f7634e4ce5af6fe55dc21a24db6afacd19bb7 --- diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 6789cd49ff..93b6987ace 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -795,6 +795,8 @@ class OracleDialect_cx_oracle(OracleDialect): if "ORA-12516" in str(err): time.sleep(2) return self.dbapi.connect(*cargs, **cparams) + else: + raise else: return super(OracleDialect_cx_oracle, self).connect( *cargs, **cparams) diff --git a/lib/sqlalchemy/testing/engines.py b/lib/sqlalchemy/testing/engines.py index 4510ba6e5a..2c077cfe0f 100644 --- a/lib/sqlalchemy/testing/engines.py +++ b/lib/sqlalchemy/testing/engines.py @@ -242,6 +242,9 @@ def testing_engine(url=None, options=None): options = config.db_opts else: options = {} + elif config.db is not None and url.drivername == config.db.url.drivername: + default_opt = config.db_opts.copy() + default_opt.update(options) engine = create_engine(url, **options) engine._has_events = True # enable event blocks, helps with profiling