From c87f6af48cdfb07efa49c407333b642dec2196b1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 25 Mar 2013 16:59:27 -0400 Subject: [PATCH] - add a nose runner that erases out argv, otherwise you get "import test" as what it tries to run with setup.py test --- README.dialects.rst | 8 +++++++- lib/sqlalchemy/dialects/mysql/base.py | 1 - lib/sqlalchemy/testing/plugin/noseplugin.py | 1 - lib/sqlalchemy/testing/runner.py | 10 ++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.dialects.rst b/README.dialects.rst index 2e1d20db82..26bc1edafe 100644 --- a/README.dialects.rst +++ b/README.dialects.rst @@ -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 diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 62598ad005..f83020d937 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2409,7 +2409,6 @@ class MySQLTableDefinitionParser(object): state.constraints.append(spec) else: pass - return state def _parse_constraints(self, line): diff --git a/lib/sqlalchemy/testing/plugin/noseplugin.py b/lib/sqlalchemy/testing/plugin/noseplugin.py index 4ce76363e3..6ad884e944 100644 --- a/lib/sqlalchemy/testing/plugin/noseplugin.py +++ b/lib/sqlalchemy/testing/plugin/noseplugin.py @@ -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('_'): diff --git a/lib/sqlalchemy/testing/runner.py b/lib/sqlalchemy/testing/runner.py index 6ec73d7c83..2bdbaebd1f 100644 --- a/lib/sqlalchemy/testing/runner.py +++ b/lib/sqlalchemy/testing/runner.py @@ -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']) -- 2.47.2