diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-27 13:17:20 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-27 13:17:20 -0400 |
| commit | e3a1a2d01c83e9451527b0c5ac316d9a510ac5bc (patch) | |
| tree | f12ebc229eaa2397c2f80ff555c8941a556c50c1 /lib/sqlalchemy/testing/plugin | |
| parent | b6411ee3cfe63d461b73e9aa8e69c6c550ddb649 (diff) | |
| download | sqlalchemy-e3a1a2d01c83e9451527b0c5ac316d9a510ac5bc.tar.gz | |
- fixes to multi-backend tests
- move the logic to determine "test id" into plugin_base
- update callcounts
Diffstat (limited to 'lib/sqlalchemy/testing/plugin')
| -rw-r--r-- | lib/sqlalchemy/testing/plugin/noseplugin.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/plugin/plugin_base.py | 15 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/plugin/pytestplugin.py | 12 |
3 files changed, 18 insertions, 13 deletions
diff --git a/lib/sqlalchemy/testing/plugin/noseplugin.py b/lib/sqlalchemy/testing/plugin/noseplugin.py index a68eb88cf..18a1178a6 100644 --- a/lib/sqlalchemy/testing/plugin/noseplugin.py +++ b/lib/sqlalchemy/testing/plugin/noseplugin.py @@ -69,7 +69,9 @@ class NoseSQLAlchemy(Plugin): return plugin_base.want_class(cls) def beforeTest(self, test): - plugin_base.before_test(test, test.id()) + plugin_base.before_test(test, + test.test.cls.__module__, + test.test.cls, test.test.method.__name__) def afterTest(self, test): plugin_base.after_test(test) diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index e9e52827b..061848e27 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -324,7 +324,7 @@ def generate_sub_tests(cls, module): name, (cls, ), { - "__only_on__": (cfg.db.name, cfg.db.driver), + "__only_on__": ("%s+%s" % (cfg.db.name, cfg.db.driver)), "__backend__": False} ) setattr(module, name, subcls) @@ -351,7 +351,18 @@ def _setup_engine(cls): eng = engines.testing_engine(options=cls.__engine_options__) config._current.push_engine(eng, testing) -def before_test(test, id_): +def before_test(test, test_module_name, test_class, test_name): + + # like a nose id, e.g.: + # "test.aaa_profiling.test_compiler.CompileTest.test_update_whereclause" + name = test_class.__name__ + + suffix = "_%s_%s" % (config.db.name, config.db.driver) + if name.endswith(suffix): + name = name[0:-(len(suffix))] + + id_ = "%s.%s.%s" % (test_module_name, name, test_name) + warnings.resetwarnings() profiling._current_test = id_ diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index f38c7ea6a..74d5cc083 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -112,16 +112,8 @@ def pytest_runtest_teardown(item): test_teardown(item) def test_setup(item): - # like a nose id, e.g.: - # "test.aaa_profiling.test_compiler.CompileTest.test_update_whereclause" - name = item.parent.cls.__name__ - - suffix = "_%s_%s" % (plugin_base.config.db.name, plugin_base.config.db.driver) - if name.endswith(suffix): - name = name[0:-(len(suffix))] - - id_ = "%s.%s.%s" % (item.parent.module.__name__, name, item.name) - plugin_base.before_test(item, id_) + plugin_base.before_test(item, + item.parent.module.__name__, item.parent.cls, item.name) def test_teardown(item): plugin_base.after_test(item) |
