summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-02-06 17:50:11 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-02-06 17:50:11 -0500
commit47858b85ec7139af83c2cd0aed1af8917d88ea3e (patch)
tree412eb0bc2532207c6c111d21dcef69e5d68683ff /lib/sqlalchemy/testing/plugin
parent4ad4e9fccbb263ac2a0e6bf5f84526b2dee19ece (diff)
downloadsqlalchemy-47858b85ec7139af83c2cd0aed1af8917d88ea3e.tar.gz
- add support for pulling in an external requirements file
- start filling in default versions of remaining requirements that are still only in test/
Diffstat (limited to 'lib/sqlalchemy/testing/plugin')
-rw-r--r--lib/sqlalchemy/testing/plugin/noseplugin.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/plugin/noseplugin.py b/lib/sqlalchemy/testing/plugin/noseplugin.py
index 81e724bbe..4ce76363e 100644
--- a/lib/sqlalchemy/testing/plugin/noseplugin.py
+++ b/lib/sqlalchemy/testing/plugin/noseplugin.py
@@ -222,13 +222,23 @@ def _reverse_topological(options, file_config):
dependency.set = RandomSet
+def _requirements_opt(options, opt_str, value, parser):
+ _setup_requirements(value)
+
@post
def _requirements(options, file_config):
+
+ requirement_cls = file_config.get('sqla_testing', "requirement_cls")
+ _setup_requirements(requirement_cls)
+
+def _setup_requirements(argument):
from sqlalchemy.testing import config
from sqlalchemy import testing
- requirement_cls = file_config.get('sqla_testing', "requirement_cls")
- modname, clsname = requirement_cls.split(":")
+ if config.requirements is not None:
+ return
+
+ modname, clsname = argument.split(":")
# importlib.import_module() only introduced in 2.7, a little
# late
@@ -236,7 +246,7 @@ def _requirements(options, file_config):
for component in modname.split(".")[1:]:
mod = getattr(mod, component)
req_cls = getattr(mod, clsname)
- config.requirements = testing.requires = req_cls(db, config)
+ config.requirements = testing.requires = req_cls(config)
@post
@@ -290,6 +300,9 @@ class NoseSQLAlchemy(Plugin):
opt("--reversetop", action="store_true", dest="reversetop", default=False,
help="Use a random-ordering set implementation in the ORM (helps "
"reveal dependency issues)")
+ opt("--requirements", action="callback", type="string",
+ callback=_requirements_opt,
+ help="requirements class for testing, overrides setup.cfg")
opt("--with-cdecimal", action="store_true", dest="cdecimal", default=False,
help="Monkeypatch the cdecimal library into Python 'decimal' for all tests")
opt("--unhashable", action="store_true", dest="unhashable", default=False,