summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/noseplugin.py
diff options
context:
space:
mode:
authorMatt Chisholm <matt@theory.org>2014-04-14 13:54:01 -0400
committerMatt Chisholm <matt@theory.org>2014-04-14 13:58:39 -0400
commitc887d62810e13e3156ac47dfbcfd709a6ac9858f (patch)
tree6b042ceb3cbc1ae3cdb9b8f969463cb90733f875 /lib/sqlalchemy/testing/plugin/noseplugin.py
parentf0d71dc2d6027158ab883ddabb83af20996108ba (diff)
downloadsqlalchemy-c887d62810e13e3156ac47dfbcfd709a6ac9858f.tar.gz
use importlib.machinery to load modules instead of imp under Python 3.3 and greater
part of #2830
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/noseplugin.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/noseplugin.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/plugin/noseplugin.py b/lib/sqlalchemy/testing/plugin/noseplugin.py
index 18a1178a6..bd38745c0 100644
--- a/lib/sqlalchemy/testing/plugin/noseplugin.py
+++ b/lib/sqlalchemy/testing/plugin/noseplugin.py
@@ -12,15 +12,20 @@ way (e.g. as a package-less import).
"""
import os
+import sys
from nose.plugins import Plugin
fixtures = None
# no package imports yet! this prevents us from tripping coverage
# too soon.
-import imp
path = os.path.join(os.path.dirname(__file__), "plugin_base.py")
-plugin_base = imp.load_source("plugin_base", path)
+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):