]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Use config.db global opts as defaults for all testing_engine()
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Mar 2017 14:13:15 +0000 (10:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Mar 2017 14:13:15 +0000 (10:13 -0400)
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

lib/sqlalchemy/dialects/oracle/cx_oracle.py
lib/sqlalchemy/testing/engines.py

index 6789cd49ffbacd3293bcb698a92d830dfa3d54d0..93b6987ace4dcf3ab3c2b8fb77343e973b178b72 100644 (file)
@@ -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)
index 4510ba6e5a2dc8c5670dbee7c6af5acdbfa6709d..2c077cfe0f8831190a2a9561ac71ddeb4dde21b8 100644 (file)
@@ -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