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_1_7~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b34463cb6e0ef28c5a95b5c5b93e36b13d110d6;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 (cherry picked from commit 28edc2604a96d5ecd8318232c95a034433aa07d1) --- diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 9b3e3b8a12..f85324f84b 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -790,6 +790,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 6bca75fb1f..dacd5a7afd 100644 --- a/lib/sqlalchemy/testing/engines.py +++ b/lib/sqlalchemy/testing/engines.py @@ -226,6 +226,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