summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/noseplugin.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-14 21:41:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-14 21:41:13 -0400
commitd7498cf4adb8ef9f35d1efa6dc747ac9eb489e60 (patch)
treede69b7ec88fef69c36704d2a7b06b1a0ffe0f17b /lib/sqlalchemy/testing/plugin/noseplugin.py
parent7fd3f05805a7cf1ff1fa29ffcf375c4eea6627ba (diff)
downloadsqlalchemy-d7498cf4adb8ef9f35d1efa6dc747ac9eb489e60.tar.gz
- remove some crufty old testing options
- reestablish the "bootstrap" system of loading the test runners in testing/plugin; using the updated approach we just came up with for alembic. Coverage should be fixed now when running either py.test or nose. fixes #3196 - upgrade tox.ini and start using a .coveragerc file
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/noseplugin.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/noseplugin.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/sqlalchemy/testing/plugin/noseplugin.py b/lib/sqlalchemy/testing/plugin/noseplugin.py
index 6ef539142..eb4a3b258 100644
--- a/lib/sqlalchemy/testing/plugin/noseplugin.py
+++ b/lib/sqlalchemy/testing/plugin/noseplugin.py
@@ -12,6 +12,14 @@ way (e.g. as a package-less import).
"""
+try:
+ # installed by bootstrap.py
+ import sqla_plugin_base as plugin_base
+except ImportError:
+ # assume we're a package, use traditional import
+ from . import plugin_base
+
+
import os
import sys
@@ -19,16 +27,6 @@ from nose.plugins import Plugin
fixtures = None
py3k = sys.version_info >= (3, 0)
-# no package imports yet! this prevents us from tripping coverage
-# too soon.
-path = os.path.join(os.path.dirname(__file__), "plugin_base.py")
-if sys.version_info >= (3, 3):
- from importlib import machinery
- plugin_base = machinery.SourceFileLoader(
- "plugin_base", path).load_module()
-else:
- import imp
- plugin_base = imp.load_source("plugin_base", path)
class NoseSQLAlchemy(Plugin):
@@ -58,10 +56,10 @@ class NoseSQLAlchemy(Plugin):
plugin_base.set_coverage_flag(options.enable_plugin_coverage)
+ def begin(self):
global fixtures
- from sqlalchemy.testing import fixtures
+ from sqlalchemy.testing import fixtures # noqa
- def begin(self):
plugin_base.post_begin()
def describeTest(self, test):
@@ -72,19 +70,21 @@ class NoseSQLAlchemy(Plugin):
def wantMethod(self, fn):
if py3k:
+ if not hasattr(fn.__self__, 'cls'):
+ return False
cls = fn.__self__.cls
else:
cls = fn.im_class
- print "METH:", fn, "CLS:", cls
return plugin_base.want_method(cls, fn)
def wantClass(self, cls):
return plugin_base.want_class(cls)
def beforeTest(self, test):
- plugin_base.before_test(test,
- test.test.cls.__module__,
- test.test.cls, test.test.method.__name__)
+ 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)