From 50866d2f857dd45bb2d186a0fa076768437d62a3 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 10 Mar 2015 15:24:28 -0400 Subject: - copyright 2015 --- lib/sqlalchemy/testing/plugin/plugin_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py') diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index b0188aa5a..14cf1eb31 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -1,5 +1,5 @@ # plugin/plugin_base.py -# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors +# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors # # # This module is part of SQLAlchemy and is released under -- cgit v1.2.1 From 088666e8f3de4816b6eeadc2dce0f473b7710bff Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 1 May 2015 09:38:21 -0400 Subject: - Fixed an import that prevented "pypy setup.py test" from working correctly. fixes #3406 --- lib/sqlalchemy/testing/plugin/plugin_base.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py') diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 14cf1eb31..84b7a6d5e 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -19,6 +19,7 @@ try: # honor it unless nose is imported too... from nose import SkipTest except ImportError: + import pytest from _pytest.runner import Skipped as SkipTest import sys -- cgit v1.2.1 From 2ef1c56436d25e8a710a8679c59400c0e4009cd6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 1 May 2015 13:15:51 -0400 Subject: - move away from explicit raises of SkipTest, instead call a function patched onto config. nose/pytest backends now fill in their exception class here only when loaded - use more public seeming api to get at py.test Skipped exception --- lib/sqlalchemy/testing/plugin/plugin_base.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py') diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 84b7a6d5e..ef304afa6 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -14,13 +14,6 @@ functionality via py.test. """ from __future__ import absolute_import -try: - # unitttest has a SkipTest also but pytest doesn't - # honor it unless nose is imported too... - from nose import SkipTest -except ImportError: - import pytest - from _pytest.runner import Skipped as SkipTest import sys import re @@ -157,6 +150,13 @@ def pre_begin(opt): def set_coverage_flag(value): options.has_coverage = value +_skip_test_exception = None + + +def set_skip_test(exc): + global _skip_test_exception + _skip_test_exception = exc + def post_begin(): """things to set up later, once we know coverage is running.""" @@ -234,6 +234,13 @@ def _monkeypatch_cdecimal(options, file_config): sys.modules['decimal'] = cdecimal +@post +def _init_skiptest(options, file_config): + from sqlalchemy.testing import config + + config._skip_test_exception = _skip_test_exception + + @post def _engine_uri(options, file_config): from sqlalchemy.testing import config @@ -507,7 +514,7 @@ def _do_skips(cls): if getattr(cls, '__skip_if__', False): for c in getattr(cls, '__skip_if__'): if c(): - raise SkipTest("'%s' skipped by %s" % ( + config.skip_test("'%s' skipped by %s" % ( cls.__name__, c.__name__) ) @@ -530,7 +537,7 @@ def _do_skips(cls): ), ", ".join(reasons) ) - raise SkipTest(msg) + config.skip_test(msg) elif hasattr(cls, '__prefer_backends__'): non_preferred = set() spec = exclusions.db_spec(*util.to_list(cls.__prefer_backends__)) -- cgit v1.2.1 From c8f38dff1143585226cd79865a6144d16ee0ba18 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 17 Jul 2015 11:09:29 -0400 Subject: - db_opts doesn't need to be a global since we no longer have any global option for it. keep it local to production of config so values don't leak in a multi --db situation. --- lib/sqlalchemy/testing/plugin/plugin_base.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py') diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index ef304afa6..6cdec05ad 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -40,7 +40,6 @@ file_config = None logging = None -db_opts = {} include_tags = set() exclude_tags = set() options = None @@ -115,7 +114,6 @@ def memoize_important_follower_config(dict_): """ dict_['memoized_config'] = { - 'db_opts': db_opts, 'include_tags': include_tags, 'exclude_tags': exclude_tags } @@ -127,8 +125,7 @@ def restore_important_follower_config(dict_): This invokes in the follower process. """ - global db_opts, include_tags, exclude_tags - db_opts.update(dict_['memoized_config']['db_opts']) + global include_tags, exclude_tags include_tags.update(dict_['memoized_config']['include_tags']) exclude_tags.update(dict_['memoized_config']['exclude_tags']) @@ -268,7 +265,7 @@ def _engine_uri(options, file_config): for db_url in db_urls: cfg = provision.setup_config( - db_url, db_opts, options, file_config, provision.FOLLOWER_IDENT) + db_url, options, file_config, provision.FOLLOWER_IDENT) if not config._current: cfg.set_as_current(cfg, testing) -- cgit v1.2.1 From 859379e2fcc4506d036700ba1eca4c0ae526a8ee Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 29 Jan 2016 11:20:22 -0500 Subject: - happy new year --- lib/sqlalchemy/testing/plugin/plugin_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py') diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 6cdec05ad..84258df92 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -1,5 +1,5 @@ # plugin/plugin_base.py -# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors +# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors # # # This module is part of SQLAlchemy and is released under -- cgit v1.2.1 From 7cb2a2d6c0cb85f7c51fcd572136589c23aa7a1b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 8 Feb 2016 16:27:55 -0500 Subject: - additional fixes to get oracle + multiprocess to be reliable --- lib/sqlalchemy/testing/plugin/plugin_base.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py') diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 84258df92..22b79d1b3 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -174,6 +174,7 @@ def post_begin(): warnings.setup_filters() + def _log(opt_str, value, parser): global logging if not logging: @@ -436,6 +437,12 @@ def _restore_engine(): config._current.reset(testing) +def final_process_cleanup(): + engines.testing_reaper._stop_test_ctx_aggressive() + assertions.global_cleanup_assertions() + _restore_engine() + + def _setup_engine(cls): if getattr(cls, '__engine_options__', None): eng = engines.testing_engine(options=cls.__engine_options__) -- cgit v1.2.1