diff options
-rwxr-xr-x | .hgignore | 3 | ||||
-rw-r--r-- | CHANGES | 11 | ||||
-rw-r--r-- | lib/sqlalchemy/test/__init__.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/test/engines.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/test/profiling.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/test/testing.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy_nose/__init__.py | 0 | ||||
-rw-r--r-- | lib/sqlalchemy_nose/config.py (renamed from lib/sqlalchemy/test/config.py) | 0 | ||||
-rw-r--r-- | lib/sqlalchemy_nose/noseplugin.py (renamed from lib/sqlalchemy/test/noseplugin.py) | 10 | ||||
-rw-r--r-- | setup.py | 12 | ||||
-rw-r--r-- | test/__init__.py | 1 |
11 files changed, 32 insertions, 15 deletions
@@ -4,4 +4,7 @@ syntax:regexp .pyc$ .orig$ .egg-info +.*,cover +\.coverage +\.DS_Store test.cfg @@ -202,7 +202,16 @@ CHANGES - *Major* cleanup / modernization of the Informix dialect for 0.6, courtesy Florian Apolloner. [ticket:1906] - + +- tests + - the NoseSQLAlchemyPlugin has been moved to a + new package "sqlalchemy_nose" which installs + along with "sqlalchemy". This so that the "nosetests" + script works as always but also allows the + --with-coverage option to turn on coverage before + SQLAlchemy modules are imported, allowing coverage + to work correctly. + - misc - CircularDependencyError now has .cycles and .edges members, which are the set of elements involved in diff --git a/lib/sqlalchemy/test/__init__.py b/lib/sqlalchemy/test/__init__.py index d69cedefd..7356945d2 100644 --- a/lib/sqlalchemy/test/__init__.py +++ b/lib/sqlalchemy/test/__init__.py @@ -6,7 +6,8 @@ by noseplugin.NoseSQLAlchemy. """ -from sqlalchemy.test import testing, engines, requires, profiling, pickleable, config +from sqlalchemy_nose import config +from sqlalchemy.test import testing, engines, requires, profiling, pickleable from sqlalchemy.test.schema import Column, Table from sqlalchemy.test.testing import \ AssertsCompiledSQL, \ diff --git a/lib/sqlalchemy/test/engines.py b/lib/sqlalchemy/test/engines.py index 9e77f38d7..870f984ec 100644 --- a/lib/sqlalchemy/test/engines.py +++ b/lib/sqlalchemy/test/engines.py @@ -1,6 +1,6 @@ import sys, types, weakref from collections import deque -import config +from sqlalchemy_nose import config from sqlalchemy.util import function_named, callable import re import warnings diff --git a/lib/sqlalchemy/test/profiling.py b/lib/sqlalchemy/test/profiling.py index c5256affa..835253a3a 100644 --- a/lib/sqlalchemy/test/profiling.py +++ b/lib/sqlalchemy/test/profiling.py @@ -6,7 +6,7 @@ in a more fine-grained way than nose's profiling plugin. """ import os, sys -from sqlalchemy.test import config +from sqlalchemy_nose import config from sqlalchemy.test.util import function_named, gc_collect from nose import SkipTest diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py index 41ba3038f..471044742 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/lib/sqlalchemy/test/testing.py @@ -8,7 +8,8 @@ import types import warnings from cStringIO import StringIO -from sqlalchemy.test import config, assertsql, util as testutil +from sqlalchemy_nose import config +from sqlalchemy.test import assertsql, util as testutil from sqlalchemy.util import function_named, py3k from engines import drop_all_tables diff --git a/lib/sqlalchemy_nose/__init__.py b/lib/sqlalchemy_nose/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/lib/sqlalchemy_nose/__init__.py diff --git a/lib/sqlalchemy/test/config.py b/lib/sqlalchemy_nose/config.py index 7d528a04b..7d528a04b 100644 --- a/lib/sqlalchemy/test/config.py +++ b/lib/sqlalchemy_nose/config.py diff --git a/lib/sqlalchemy/test/noseplugin.py b/lib/sqlalchemy_nose/noseplugin.py index 6a3106e69..8732142f7 100644 --- a/lib/sqlalchemy/test/noseplugin.py +++ b/lib/sqlalchemy_nose/noseplugin.py @@ -10,9 +10,9 @@ import StringIO import nose.case from nose.plugins import Plugin -from sqlalchemy import util, log as sqla_log -from sqlalchemy.test import testing, config, requires -from sqlalchemy.test.config import ( +from sqlalchemy_nose import config + +from sqlalchemy_nose.config import ( _create_testing_engine, _engine_pool, _engine_strategy, _engine_uri, _list_dbs, _log, _prep_testing_database, _require, _reverse_topological, _server_side_cursors, _set_table_options, base_config, db, db_label, db_url, file_config, post_configure) @@ -78,6 +78,10 @@ class NoseSQLAlchemy(Plugin): self.options = options def begin(self): + global testing, requires, util + from sqlalchemy.test import testing, requires + from sqlalchemy import util + testing.db = db testing.requires = requires @@ -56,11 +56,11 @@ elif BUILD_CEXTENSIONS: def find_packages(dir_): packages = [] - for _dir, subdirectories, files in os.walk(os.path.join(dir_, - 'sqlalchemy')): - if '__init__.py' in files: - lib, fragment = _dir.split(os.sep, 1) - packages.append(fragment.replace(os.sep, '.')) + for pkg in ['sqlalchemy', 'sqlalchemy_nose']: + for _dir, subdirectories, files in os.walk(os.path.join(dir_, pkg)): + if '__init__.py' in files: + lib, fragment = _dir.split(os.sep, 1) + packages.append(fragment.replace(os.sep, '.')) return packages if sys.version_info < (2, 4): @@ -90,7 +90,7 @@ setup(name = "SQLAlchemy", test_suite = "nose.collector", entry_points = { 'nose.plugins.0.10': [ - 'sqlalchemy = sqlalchemy.test.noseplugin:NoseSQLAlchemy', + 'sqlalchemy = sqlalchemy_nose.noseplugin:NoseSQLAlchemy', ] }, diff --git a/test/__init__.py b/test/__init__.py index 8b1378917..e69de29bb 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1 +0,0 @@ - |