]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add a nose runner that erases out argv, otherwise
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 25 Mar 2013 20:59:27 +0000 (16:59 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 25 Mar 2013 20:59:27 +0000 (16:59 -0400)
you get "import test" as what it tries to run with
setup.py test

README.dialects.rst
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/testing/plugin/noseplugin.py
lib/sqlalchemy/testing/runner.py

index 2e1d20db822fcac3fa5b74c370c2676f1355b96d..26bc1edafe8d2b76d62d7c215210d45cca3a4a2a 100644 (file)
@@ -112,7 +112,13 @@ Key aspects of this file layout include:
 
     from sqlalchemy.testing import runner
 
-    runner.main()
+    # use this in setup.py 'test_suite':
+    # test_suite="run_tests.setup_py_test"
+    def setup_py_test():
+        runner.setup_py_test()
+
+    if __name__ == '__main__':
+        runner.main()
 
   Where above, the ``registry`` module, introduced in SQLAlchemy 0.8, provides
   an in-Python means of installing the dialect entrypoints without the use
index 62598ad005336c336478c68859b6815702eba50c..f83020d93793a8759a7bb7b17977499c8d3c10c0 100644 (file)
@@ -2409,7 +2409,6 @@ class MySQLTableDefinitionParser(object):
                     state.constraints.append(spec)
                 else:
                     pass
-
         return state
 
     def _parse_constraints(self, line):
index 4ce76363e3d0779de8360ecace454ae4faacdbe5..6ad884e944e242e8bfac60b5a711fdce9ddc3664 100644 (file)
@@ -361,7 +361,6 @@ class NoseSQLAlchemy(Plugin):
              The class being examined by the selector
 
         """
-
         if not issubclass(cls, fixtures.TestBase):
             return False
         elif cls.__name__.startswith('_'):
index 6ec73d7c837757069149234212e67d1335b9a995..2bdbaebd1f11ed7b0e4eb475e0dfb1a36486fbd0 100644 (file)
@@ -31,3 +31,13 @@ import nose
 
 def main():
     nose.main(addplugins=[NoseSQLAlchemy()])
+
+def setup_py_test():
+    """Runner to use for the 'test_suite' entry of your setup.py.
+
+    Prevents any name clash shenanigans from the command line
+    argument "test" that the "setup.py test" command sends
+    to nose.
+
+    """
+    nose.main(addplugins=[NoseSQLAlchemy()], argv=['runner'])