summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/plugin_base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-07-25 18:33:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-07-25 18:33:04 -0400
commit9e6624c0496e22ec1139e0fb54cfefc14f660352 (patch)
tree673048a2c63d3f59b94fa1326c6b9adfb636bfe1 /lib/sqlalchemy/testing/plugin/plugin_base.py
parentfe878f5aff1cb17fdf1f13aba1d13f008da0ef4e (diff)
downloadsqlalchemy-9e6624c0496e22ec1139e0fb54cfefc14f660352.tar.gz
- proof of concept for parallel testing
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index 2590f3b1e..47d297b2e 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -31,6 +31,7 @@ if py3k:
else:
import ConfigParser as configparser
+FOLLOWER_IDENT = None
# late imports
fixtures = None
@@ -100,6 +101,11 @@ def setup_options(make_option):
help="Write/update profiling data.")
+def configure_follower(follower_ident):
+ global FOLLOWER_IDENT
+ FOLLOWER_IDENT = "test_%s" % follower_ident
+
+
def read_config():
global file_config
file_config = configparser.ConfigParser()
@@ -135,6 +141,7 @@ def post_begin():
from sqlalchemy import util
+
def _log(opt_str, value, parser):
global logging
if not logging:
@@ -176,6 +183,7 @@ def post(fn):
return fn
+
@pre
def _setup_options(opt, file_config):
global options
@@ -214,6 +222,10 @@ def _engine_uri(options, file_config):
db_urls.append(file_config.get('db', 'default'))
for db_url in db_urls:
+ if FOLLOWER_IDENT:
+ from sqlalchemy.engine import url
+ db_url = url.make_url(db_url)
+ db_url.database = FOLLOWER_IDENT
eng = engines.testing_engine(db_url, db_opts)
eng.connect().close()
config.Config.register(eng, db_opts, options, file_config, testing)