]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- repair that we use db_opts when the url here is different,
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Jun 2015 23:24:10 +0000 (19:24 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Jun 2015 23:24:10 +0000 (19:24 -0400)
as we are using db_opts for the first time with legacy_schema_args

lib/sqlalchemy/testing/engines.py

index 8bd1becbf10e429039752265cfa671cc3baa3a63..1eaf629601f50d5ad2ed0f053b3540337311596b 100644 (file)
@@ -211,6 +211,7 @@ def testing_engine(url=None, options=None):
     """Produce an engine configured by --options with optional overrides."""
 
     from sqlalchemy import create_engine
+    from sqlalchemy.engine.url import make_url
 
     if not options:
         use_reaper = True
@@ -218,12 +219,16 @@ def testing_engine(url=None, options=None):
         use_reaper = options.pop('use_reaper', True)
 
     url = url or config.db.url
+
+    url = make_url(url)
     if options is None:
-        options = config.db_opts
+        if config.db is None or url.drivername == config.db.url.drivername:
+            options = config.db_opts
+        else:
+            options = {}
 
     engine = create_engine(url, **options)
-    engine._has_events = True   # enable event blocks, helps with
-                                # profiling
+    engine._has_events = True   # enable event blocks, helps with profiling
 
     if isinstance(engine.pool, pool.QueuePool):
         engine.pool._timeout = 0