]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add a runner module
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Sep 2012 07:06:40 +0000 (03:06 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Sep 2012 07:06:40 +0000 (03:06 -0400)
- make "default" the default dialect.

lib/sqlalchemy/testing/plugin/config.py
lib/sqlalchemy/testing/plugin/noseplugin.py
lib/sqlalchemy/testing/runner.py [new file with mode: 0644]
setup.cfg

index a29c515a18fe67d690dc8dc40aee70c35227eb91..785b69acea6168afdfa5d800effcf2ee13a1be38 100644 (file)
@@ -59,7 +59,7 @@ pre_configure.append(_monkeypatch_cdecimal)
 
 def _engine_uri(options, file_config):
     global db_label, db_url
-    db_label = 'sqlite'
+
     if options.dburi:
         db_url = options.dburi
         db_label = db_url[:db_url.index(':')]
index 8411748345111eb14d0cfdd587f0d8036c6a2ac7..31430c8d0763831fbfca95565cd9c6e246c20deb 100644 (file)
@@ -49,7 +49,7 @@ class NoseSQLAlchemy(Plugin):
             help="turn on debug logging for <LOG> (multiple OK)")
         opt("--require", action="append", dest="require", default=[],
             help="require a particular driver or module version (multiple OK)")
-        opt("--db", action="store", dest="db", default="sqlite",
+        opt("--db", action="store", dest="db", default="default",
             help="Use prefab database uri")
         opt('--dbs', action='callback', callback=_list_dbs,
             help="List available prefab dbs")
diff --git a/lib/sqlalchemy/testing/runner.py b/lib/sqlalchemy/testing/runner.py
new file mode 100644 (file)
index 0000000..0a82a47
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+"""
+Nose test runner module.
+
+This script is a front-end to "nosetests" which
+installs SQLAlchemy's testing plugin into the local environment.
+
+The script is intended to be used by third-party dialects and extensions
+that run within SQLAlchemy's testing framework.    The runner can
+be invoked via::
+
+    python -m sqlalchemy.testing.runner
+
+The script is then essentially the same as the "nosetests" script, including
+all of the usual Nose options.   The test environment requires that a
+setup.cfg is locally present including various required options.
+
+Note that when using this runner, Nose's "coverage" plugin will not be
+able to provide coverage for SQLAlchemy itself, since SQLAlchemy is
+imported into sys.modules before coverage is started.   The special
+script sqla_nose.py is provided as a top-level script which loads the
+plugin in a special (somewhat hacky) way so that coverage against
+SQLAlchemy itself is possible.
+
+"""
+
+from sqlalchemy.testing.plugin.noseplugin import NoseSQLAlchemy
+
+import nose
+
+nose.main(addplugins=[NoseSQLAlchemy()])
index ef1b8dbcc04085cb239d45f6acd8f70bf78692a8..f93d4a7b221198806821b5256189d5bbfd181af2 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -12,6 +12,7 @@ requirement_cls=test.requirements:DefaultRequirements
 profile_file=test/profiles.txt
 
 [db]
+default=sqlite:///:memory:
 sqlite=sqlite:///:memory:
 sqlite_file=sqlite:///querytest.db
 postgresql=postgresql://scott:tiger@127.0.0.1:5432/test