diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2020-08-14 22:20:44 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-08-14 22:20:44 +0000 |
| commit | 8a274e0058183cebeb37d3a5e7903209ce5e7c0e (patch) | |
| tree | e4a961d163c6d594e29fc09d1bd7240123d13548 /lib/sqlalchemy/testing/plugin/plugin_base.py | |
| parent | f91d335e31e5e14794e349b74edc08aad0f361e3 (diff) | |
| parent | 3231e281efb2f36dd0dbd628efcd684175064386 (diff) | |
| download | sqlalchemy-8a274e0058183cebeb37d3a5e7903209ce5e7c0e.tar.gz | |
Merge "Provision on different drivers dynamically"
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py')
| -rw-r--r-- | lib/sqlalchemy/testing/plugin/plugin_base.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 49ff0f975..b5f2a3e0b 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -17,10 +17,14 @@ is pytest. from __future__ import absolute_import import abc +import logging import re import sys +log = logging.getLogger("sqlalchemy.testing.plugin_base") + + py3k = sys.version_info >= (3, 0) if py3k: @@ -91,6 +95,15 @@ def setup_options(make_option): help="Database uri. Multiple OK, " "first one is run by default.", ) make_option( + "--dbdriver", + action="append", + type="string", + dest="dbdriver", + help="Additional database drivers to include in tests. " + "These are linked to the existing database URLs by the " + "provisioning system.", + ) + make_option( "--dropfirst", action="store_true", dest="dropfirst", @@ -350,6 +363,7 @@ def _init_symbols(options, file_config): @post def _engine_uri(options, file_config): + from sqlalchemy.testing import config from sqlalchemy import testing from sqlalchemy.testing import provision @@ -359,6 +373,8 @@ def _engine_uri(options, file_config): else: db_urls = [] + extra_drivers = options.dbdriver or [] + if options.db: for db_token in options.db: for db in re.split(r"[,\s]+", db_token): @@ -374,7 +390,11 @@ def _engine_uri(options, file_config): db_urls.append(file_config.get("db", "default")) config._current = None - for db_url in db_urls: + + expanded_urls = list(provision.generate_db_urls(db_urls, extra_drivers)) + + for db_url in expanded_urls: + log.info("Adding database URL: %s", db_url) if options.write_idents and provision.FOLLOWER_IDENT: # != 'master': with open(options.write_idents, "a") as file_: @@ -596,7 +616,8 @@ def stop_test_class(cls): def _restore_engine(): - config._current.reset(testing) + if config._current: + config._current.reset(testing) def final_process_cleanup(): |
