summaryrefslogtreecommitdiff
path: root/sqla_nose.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 /sqla_nose.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 'sqla_nose.py')
-rwxr-xr-xsqla_nose.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/sqla_nose.py b/sqla_nose.py
index f89a1dce0..b977f4bf5 100755
--- a/sqla_nose.py
+++ b/sqla_nose.py
@@ -8,22 +8,25 @@ installs SQLAlchemy's testing plugin into the local environment.
"""
import sys
import nose
-import warnings
+import os
-from os import path
for pth in ['./lib']:
- sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), pth))
+ sys.path.insert(
+ 0, os.path.join(os.path.dirname(os.path.abspath(__file__)), pth))
-# installing without importing SQLAlchemy, so that coverage includes
-# SQLAlchemy itself.
-path = "lib/sqlalchemy/testing/plugin/noseplugin.py"
-if sys.version_info >= (3, 3):
- from importlib import machinery
- noseplugin = machinery.SourceFileLoader("noseplugin", path).load_module()
-else:
- import imp
- noseplugin = imp.load_source("noseplugin", path)
+# use bootstrapping so that test plugins are loaded
+# without touching the main library before coverage starts
+bootstrap_file = os.path.join(
+ os.path.dirname(__file__), "lib", "sqlalchemy",
+ "testing", "plugin", "bootstrap.py"
+)
+with open(bootstrap_file) as f:
+ code = compile(f.read(), "bootstrap.py", 'exec')
+ to_bootstrap = "nose"
+ exec(code, globals(), locals())
-nose.main(addplugins=[noseplugin.NoseSQLAlchemy()])
+
+from noseplugin import NoseSQLAlchemy
+nose.main(addplugins=[NoseSQLAlchemy()])