diff options
author | Mike Bayer <classic@zzzcomputing.com> | 2014-04-14 14:55:59 -0400 |
---|---|---|
committer | Mike Bayer <classic@zzzcomputing.com> | 2014-04-14 14:55:59 -0400 |
commit | a347741d35037acef9e80b41ea379c0a34af6dde (patch) | |
tree | 6b042ceb3cbc1ae3cdb9b8f969463cb90733f875 | |
parent | 73095b3531244250ee5af70ced6eecc16d4add3b (diff) | |
parent | c887d62810e13e3156ac47dfbcfd709a6ac9858f (diff) | |
download | sqlalchemy-a347741d35037acef9e80b41ea379c0a34af6dde.tar.gz |
Merged in goodscloud/sqlalchemy (pull request #14)
fixes for #2830
-rw-r--r-- | lib/sqlalchemy/testing/plugin/noseplugin.py | 9 | ||||
-rwxr-xr-x | sqla_nose.py | 8 | ||||
-rwxr-xr-x | test/conftest.py | 1 | ||||
-rw-r--r-- | test/sql/test_types.py | 3 |
4 files changed, 15 insertions, 6 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): diff --git a/sqla_nose.py b/sqla_nose.py index a01e00152..281b729a5 100755 --- a/sqla_nose.py +++ b/sqla_nose.py @@ -7,7 +7,6 @@ installs SQLAlchemy's testing plugin into the local environment. """ import sys -import imp import nose import warnings @@ -19,7 +18,12 @@ for pth in ['./lib']: # installing without importing SQLAlchemy, so that coverage includes # SQLAlchemy itself. path = "lib/sqlalchemy/testing/plugin/noseplugin.py" -noseplugin = imp.load_source("noseplugin", path) +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) nose.main(addplugins=[noseplugin.NoseSQLAlchemy()]) diff --git a/test/conftest.py b/test/conftest.py index c07e9e25f..1dd442309 100755 --- a/test/conftest.py +++ b/test/conftest.py @@ -7,7 +7,6 @@ installs SQLAlchemy's testing plugin into the local environment. """ import sys -import imp from os import path for pth in ['../lib']: diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 91e467aed..e887e2a7e 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -1218,7 +1218,8 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults): def load_stream(self, name): f = os.path.join(os.path.dirname(__file__), "..", name) - return open(f, mode='rb').read() + with open(f, mode='rb') as o: + return o.read() class ExpressionTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): __dialect__ = 'default' |