diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-28 14:19:44 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-28 14:19:44 -0500 |
commit | 58b29394337b5a51ce71e96cc4ba6fd68218a999 (patch) | |
tree | 29070391c9935ed3079a9108fe6fb2dd78e95d7b | |
parent | 94bb2f428e6408c675c306cafb4683c88b48b3dd (diff) | |
parent | fd4f39648aa7949e2c64626982e401fcbc928e1f (diff) | |
download | sqlalchemy-58b29394337b5a51ce71e96cc4ba6fd68218a999.tar.gz |
- sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".
Rationale:
- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options
[ticket:1949]
141 files changed, 507 insertions, 534 deletions
diff --git a/README.py3k b/README.py3k index 95ecb7f3a..b69fe3d2c 100644 --- a/README.py3k +++ b/README.py3k @@ -39,17 +39,9 @@ The above will rewrite all files in-place in Python 3 format. Running Tests ------------- -To run the unit tests, ensure Distribute is installed as above, -and also that at least the ./lib/ and ./test/ directories have been converted -to Python 3 using the source tool above. A Python 3 version of Nose -can be acquired from Bitbucket using Mercurial: - - hg clone http://bitbucket.org/jpellerin/nose3/ - cd nose3 - python3 setup.py install - -The tests can then be run using the "nosetests3" script installed by the above, -using the same instructions in README.unittests. +To run unit tests in Py3k, Nose 1.0 is required, or a development +version of Nose that supports Python 3. The tests are run +using ./sqla_nose.py as described in README.unittests. Current 3k Issues ----------------- diff --git a/README.unittests b/README.unittests index 6b2320907..b9e37db7c 100644 --- a/README.unittests +++ b/README.unittests @@ -5,59 +5,37 @@ SQLALCHEMY UNIT TESTS SQLAlchemy unit tests by default run using Python's built-in sqlite3 module. If running on Python 2.4, pysqlite must be installed. -Unit tests are run using nose. Note that in most cases, -nose needs to be installed manually. Documentation and -downloads for nose are available at: +Unit tests are run using nose. Nose is available at: -http://somethingaboutorange.com/mrl/projects/nose/0.11.1/index.html - -Or using setuptools: - - $ easy_install nose + http://pypi.python.org/pypi/nose/ SQLAlchemy implements a nose plugin that must be present when tests are run. -This plugin is available when SQLAlchemy is installed via setuptools. +This plugin is invoked when the test runner script provided with +SQLAlchemy is used. -INSTANT TEST RUNNER -------------------- +**NOTE:** - the nose plugin is no longer installed by setuptools as of +version 0.7 ! Use "python setup.py test" or "./sqla_nose.py". +RUNNING TESTS VIA SETUP.PY +-------------------------- A plain vanilla run of all tests using sqlite can be run via setup.py: $ python setup.py test - -(NOTE: this command is broken for Python 2.7 with nose 0.11.3, see -Nose issue 340. You will need to use 'nosetests' directly, see below.) - -Setuptools will take care of the rest ! To run nose directly and have -its full set of options available, read on... - -SETUP ------ -All that's required is for SQLAlchemy to be installed via setuptools. -For example, to create a local install in a source distribution directory: +The -v flag also works here: - $ export PYTHONPATH=. - $ python setup.py develop -d . + $ python setup.py test -v -The above will create a setuptools "development" distribution in the local -path, which allows the Nose plugin to be available when nosetests is run. -The plugin is enabled using the "with-sqlalchemy=True" configuration -in setup.cfg. - -RUNNING ALL TESTS ------------------ +RUNNING ALL TESTS +------------------ To run all tests: - $ nosetests - -(NOTE: if running with Python 2.7 and nose 0.11.3, add "-w test/" to the command. -Again this is a Nose issue, see Nose issue 342.) + $ ./sqla_nose.py If you're running the tests on Microsoft Windows, then there is an additional -argument that must be passed to nosetests: +argument that must be passed to ./sqla_nose.py: - > nosetests --first-package-wins=True + > ./sqla_nose.py --first-package-wins=True This is required because nose’s importer will normally evict a package from sys.modules if it sees a package with the same name in a different location. @@ -66,39 +44,29 @@ Setting this argument disables that behavior. Assuming all tests pass, this is a very unexciting output. To make it more intersesting: - $ nosetests -v - -ALTERNATE TEST RUNNER ---------------------- - -The script "sqla_nose.py" is a front-end to Nose which manually associates -the SQLAlchemy testing plugin with Nose at runtime. This script can run the -tests without any reliance upon setuptools. In 0.7 we'll be removing the -Nose plugin from setup, so this will be the way going forward to run tests: - - $ python sqla_nose.py -v + $ ./sqla_nose.py -v RUNNING INDIVIDUAL TESTS ------------------------- Any directory of test modules can be run at once by specifying the directory path: - $ nosetest test/dialect + $ ./sqla_nose.py test/dialect Any test module can be run directly by specifying its module name: - $ nosetests test.orm.test_mapper + $ ./sqla_nose.py test.orm.test_mapper To run a specific test within the module, specify it as module:ClassName.methodname: - $ nosetests test.orm.test_mapper:MapperTest.test_utils + $ ./sqla_nose.py test.orm.test_mapper:MapperTest.test_utils COMMAND LINE OPTIONS -------------------- Help is available via --help: - $ nosetests --help + $ ./sqla_nose.py --help The --help screen is a combination of common nose options and options which the SQLAlchemy nose plugin adds. The most commonly SQLAlchemy-specific @@ -186,7 +154,7 @@ Additional steps specific to individual databases are as follows: If you'll be running the tests frequently, database aliases can save a lot of typing. The --dbs option lists the built-in aliases and their matching URLs: - $ nosetests --dbs + $ ./sqla_nose.py --dbs Available --db options (use --dburi to override) mysql mysql://scott:tiger@127.0.0.1:3306/test oracle oracle://scott:tiger@127.0.0.1:1521 @@ -195,7 +163,7 @@ typing. The --dbs option lists the built-in aliases and their matching URLs: To run tests against an aliased database: - $ nosetests --db=postgresql + $ ./sqla_nose.py --db=postgresql To customize the URLs with your own users or hostnames, make a simple .ini file called `test.cfg` at the top level of the SQLAlchemy source distribution @@ -213,7 +181,7 @@ SQLAlchemy logs its activity and debugging through Python's logging package. Any log target can be directed to the console with command line options, such as: - $ nosetests test.orm.unitofwork --log-info=sqlalchemy.orm.mapper \ + $ ./sqla_nose.py test.orm.unitofwork --log-info=sqlalchemy.orm.mapper \ --log-debug=sqlalchemy.pool --log-info=sqlalchemy.engine This would log mapper configuration, connection pool checkouts, and SQL @@ -225,7 +193,7 @@ BUILT-IN COVERAGE REPORTING Coverage is tracked using Nose's coverage plugin. See the nose documentation for details. Basic usage is: - $ nosetests test.sql.test_query --with-coverage + $ ./sqla_nose.py test.sql.test_query --with-coverage BIG COVERAGE TIP !!! There is an issue where existing .pyc files may store the incorrect filepaths, which will break the coverage system. If @@ -2,6 +2,6 @@ tag_build = dev [nosetests] -with-sqlalchemy = true +with-_sqlalchemy = true exclude = ^examples first-package-wins = true @@ -56,7 +56,7 @@ elif BUILD_CEXTENSIONS: def find_packages(dir_): packages = [] - for pkg in ['sqlalchemy', 'sqlalchemy_nose']: + for pkg in ['sqlalchemy']: for _dir, subdirectories, files in os.walk(os.path.join(dir_, pkg)): if '__init__.py' in files: lib, fragment = _dir.split(os.sep, 1) @@ -82,17 +82,8 @@ setup(name = "SQLAlchemy", package_dir = {'':'lib'}, license = "MIT License", - # TODO: this is nice, but Python 3 support ? - # any way to make it not install for build/install ? - #setup_requires=["setuptools_hg"], - tests_require = ['nose >= 0.11'], - test_suite = "nose.collector", - entry_points = { - 'nose.plugins.0.10': [ - 'sqlalchemy = sqlalchemy_nose.noseplugin:NoseSQLAlchemy', - ] - }, + test_suite = "sqla_nose", long_description = """\ SQLAlchemy is: diff --git a/sqla_nose.py b/sqla_nose.py index 302fb5b08..09481410c 100755 --- a/sqla_nose.py +++ b/sqla_nose.py @@ -2,20 +2,18 @@ """ nose runner script. -This script is a front-end to "nosetests" which doesn't -require that SQLA's testing plugin be installed via setuptools. +This script is a front-end to "nosetests" which +installs SQLAlchemy's testing plugin into the local environment. """ import sys -try: - from sqlalchemy_nose.noseplugin import NoseSQLAlchemy -except ImportError: - from os import path - sys.path.append(path.join(path.dirname(path.abspath(__file__)), 'lib')) - from sqlalchemy_nose.noseplugin import NoseSQLAlchemy +from os import path +for pth in ['.', './lib']: + sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), pth)) + +from test.bootstrap.noseplugin import NoseSQLAlchemy import nose -if __name__ == '__main__': - nose.main(addplugins=[NoseSQLAlchemy()]) +nose.main(addplugins=[NoseSQLAlchemy()]) diff --git a/test/aaa_profiling/test_compiler.py b/test/aaa_profiling/test_compiler.py index 160385e95..ea33b96dc 100644 --- a/test/aaa_profiling/test_compiler.py +++ b/test/aaa_profiling/test_compiler.py @@ -1,5 +1,5 @@ from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * class CompileTest(TestBase, AssertsExecutionResults): diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py index 7c0979d57..f6de1fa2f 100644 --- a/test/aaa_profiling/test_memusage.py +++ b/test/aaa_profiling/test_memusage.py @@ -1,17 +1,17 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy.orm import mapper, relationship, create_session, \ clear_mappers, sessionmaker, class_mapper from sqlalchemy.orm.mapper import _mapper_registry from sqlalchemy.orm.session import _sessions from sqlalchemy.util import jython import operator -from sqlalchemy.test import testing, engines +from test.lib import testing, engines from sqlalchemy import MetaData, Integer, String, ForeignKey, \ PickleType, create_engine, Unicode -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column import sqlalchemy as sa from sqlalchemy.sql import column -from sqlalchemy.test.util import gc_collect +from test.lib.util import gc_collect import gc import weakref from test.orm import _base diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index d7e7b8c00..f2edebe06 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message from sqlalchemy import exc as sa_exc, util, Integer, String, ForeignKey from sqlalchemy.orm import exc as orm_exc, mapper, relationship, \ sessionmaker -from sqlalchemy.test import testing, profiling +from test.lib import testing, profiling from test.orm import _base -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column class MergeTest(_base.MappedTest): diff --git a/test/aaa_profiling/test_pool.py b/test/aaa_profiling/test_pool.py index b34144feb..1df93d980 100644 --- a/test/aaa_profiling/test_pool.py +++ b/test/aaa_profiling/test_pool.py @@ -1,5 +1,5 @@ from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * from sqlalchemy.pool import QueuePool diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index bd9d3ae50..9904267dc 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -1,5 +1,5 @@ from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * NUM_FIELDS = 10 NUM_RECORDS = 1000 diff --git a/test/aaa_profiling/test_zoomark.py b/test/aaa_profiling/test_zoomark.py index dc990e983..ec489beb1 100644 --- a/test/aaa_profiling/test_zoomark.py +++ b/test/aaa_profiling/test_zoomark.py @@ -7,7 +7,7 @@ import datetime import sys import time from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * ITERATIONS = 1 dbapi_session = engines.ReplayableSession() metadata = None diff --git a/test/aaa_profiling/test_zoomark_orm.py b/test/aaa_profiling/test_zoomark_orm.py index 623ec67ba..11285f972 100644 --- a/test/aaa_profiling/test_zoomark_orm.py +++ b/test/aaa_profiling/test_zoomark_orm.py @@ -8,7 +8,7 @@ import sys import time from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import * +from test.lib import * ITERATIONS = 1 dbapi_session = engines.ReplayableSession() metadata = None diff --git a/test/base/test_dependency.py b/test/base/test_dependency.py index 605a16cc3..6d4662be5 100644 --- a/test/base/test_dependency.py +++ b/test/base/test_dependency.py @@ -1,7 +1,7 @@ import sqlalchemy.topological as topological -from sqlalchemy.test import TestBase -from sqlalchemy.test.testing import assert_raises, eq_ -from sqlalchemy.test.util import conforms_partial_ordering +from test.lib import TestBase +from test.lib.testing import assert_raises, eq_ +from test.lib.util import conforms_partial_ordering from sqlalchemy import exc, util diff --git a/test/base/test_events.py b/test/base/test_events.py index 292059877..1baed241b 100644 --- a/test/base/test_events.py +++ b/test/base/test_events.py @@ -1,6 +1,6 @@ """Test event registration and listening.""" -from sqlalchemy.test.testing import TestBase, eq_, assert_raises +from test.lib.testing import TestBase, eq_, assert_raises from sqlalchemy import event, exc, util class TestEvents(TestBase): diff --git a/test/base/test_except.py b/test/base/test_except.py index 78a534e67..f02ca988b 100644 --- a/test/base/test_except.py +++ b/test/base/test_except.py @@ -2,7 +2,7 @@ from sqlalchemy import exc as sa_exceptions -from sqlalchemy.test import TestBase +from test.lib import TestBase # Py3K #StandardError = BaseException diff --git a/test/base/test_utils.py b/test/base/test_utils.py index d083a8458..4f02d3811 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -1,9 +1,9 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import copy, threading from sqlalchemy import util, sql, exc -from sqlalchemy.test import TestBase -from sqlalchemy.test.testing import eq_, is_, ne_ -from sqlalchemy.test.util import gc_collect, picklers +from test.lib import TestBase +from test.lib.testing import eq_, is_, ne_ +from test.lib.util import gc_collect, picklers from sqlalchemy.util import classproperty diff --git a/lib/sqlalchemy_nose/__init__.py b/test/bootstrap/__init__.py index e69de29bb..e69de29bb 100644 --- a/lib/sqlalchemy_nose/__init__.py +++ b/test/bootstrap/__init__.py diff --git a/lib/sqlalchemy_nose/config.py b/test/bootstrap/config.py index 7d528a04b..ef37e4f20 100644 --- a/lib/sqlalchemy_nose/config.py +++ b/test/bootstrap/config.py @@ -123,14 +123,14 @@ def _engine_pool(options, file_config): post_configure['engine_pool'] = _engine_pool def _create_testing_engine(options, file_config): - from sqlalchemy.test import engines, testing + from test.lib import engines, testing global db db = engines.testing_engine(db_url, db_opts) testing.db = db post_configure['create_engine'] = _create_testing_engine def _prep_testing_database(options, file_config): - from sqlalchemy.test import engines + from test.lib import engines from sqlalchemy import schema # also create alt schemas etc. here? @@ -152,7 +152,7 @@ def _prep_testing_database(options, file_config): post_configure['prep_db'] = _prep_testing_database def _set_table_options(options, file_config): - from sqlalchemy.test import schema + from test.lib import schema table_options = schema.table_options for spec in options.tableopts: @@ -167,7 +167,7 @@ def _reverse_topological(options, file_config): if options.reversetop: from sqlalchemy.orm import unitofwork, session, mapper, dependency from sqlalchemy import topological - from sqlalchemy.test.util import RandomSet + from test.lib.util import RandomSet topological.set = unitofwork.set = session.set = mapper.set = dependency.set = RandomSet post_configure['topological'] = _reverse_topological diff --git a/lib/sqlalchemy_nose/noseplugin.py b/test/bootstrap/noseplugin.py index 8732142f7..c2a152aa6 100644 --- a/lib/sqlalchemy_nose/noseplugin.py +++ b/test/bootstrap/noseplugin.py @@ -10,9 +10,9 @@ import StringIO import nose.case from nose.plugins import Plugin -from sqlalchemy_nose import config +from test.bootstrap import config -from sqlalchemy_nose.config import ( +from test.bootstrap.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) @@ -24,7 +24,10 @@ class NoseSQLAlchemy(Plugin): Handles the setup and extra properties required for testing SQLAlchemy """ enabled = True - name = 'sqlalchemy' + + # nose 1.0 will allow us to replace the old "sqlalchemy" plugin, + # if installed, using the same name, but nose 1.0 isn't released yet... + name = '_sqlalchemy' score = 100 def options(self, parser, env=os.environ): @@ -79,7 +82,7 @@ class NoseSQLAlchemy(Plugin): def begin(self): global testing, requires, util - from sqlalchemy.test import testing, requires + from test.lib import testing, requires from sqlalchemy import util testing.db = db diff --git a/test/dialect/test_access.py b/test/dialect/test_access.py index 0ea8d9a61..bd0d7c22a 100644 --- a/test/dialect/test_access.py +++ b/test/dialect/test_access.py @@ -1,7 +1,7 @@ from sqlalchemy import * from sqlalchemy import sql from sqlalchemy.databases import access -from sqlalchemy.test import * +from test.lib import * class CompileTest(TestBase, AssertsCompiledSQL): diff --git a/test/dialect/test_firebird.py b/test/dialect/test_firebird.py index 41a50e6a3..814c267b5 100644 --- a/test/dialect/test_firebird.py +++ b/test/dialect/test_firebird.py @@ -1,9 +1,9 @@ -from sqlalchemy.test.testing import eq_, assert_raises +from test.lib.testing import eq_, assert_raises from sqlalchemy import * from sqlalchemy.databases import firebird from sqlalchemy.exc import ProgrammingError from sqlalchemy.sql import table, column -from sqlalchemy.test import * +from test.lib import * class DomainReflectionTest(TestBase, AssertsExecutionResults): diff --git a/test/dialect/test_informix.py b/test/dialect/test_informix.py index ceec587d9..ea74dcbe4 100644 --- a/test/dialect/test_informix.py +++ b/test/dialect/test_informix.py @@ -1,6 +1,6 @@ from sqlalchemy import * from sqlalchemy.databases import informix -from sqlalchemy.test import * +from test.lib import * class CompileTest(TestBase, AssertsCompiledSQL): diff --git a/test/dialect/test_maxdb.py b/test/dialect/test_maxdb.py index 4df049030..7d43d594b 100644 --- a/test/dialect/test_maxdb.py +++ b/test/dialect/test_maxdb.py @@ -1,12 +1,12 @@ """MaxDB-specific tests.""" -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import StringIO, sys from sqlalchemy import * from sqlalchemy import exc, sql from decimal import Decimal from sqlalchemy.databases import maxdb -from sqlalchemy.test import * +from test.lib import * # TODO diff --git a/test/dialect/test_mssql.py b/test/dialect/test_mssql.py index e766a8301..26c53298c 100644 --- a/test/dialect/test_mssql.py +++ b/test/dialect/test_mssql.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import datetime import os import re @@ -11,8 +11,8 @@ from sqlalchemy.sql import table, column from sqlalchemy.databases import mssql from sqlalchemy.dialects.mssql import pyodbc, mxodbc, pymssql from sqlalchemy.engine import url -from sqlalchemy.test import * -from sqlalchemy.test.testing import eq_, emits_warning_on, \ +from test.lib import * +from test.lib.testing import eq_, emits_warning_on, \ assert_raises_message class CompileTest(TestBase, AssertsCompiledSQL): diff --git a/test/dialect/test_mxodbc.py b/test/dialect/test_mxodbc.py index f574177dd..36cfc9b08 100644 --- a/test/dialect/test_mxodbc.py +++ b/test/dialect/test_mxodbc.py @@ -1,6 +1,6 @@ from sqlalchemy import * -from sqlalchemy.test.testing import eq_, TestBase -from sqlalchemy.test import engines +from test.lib.testing import eq_, TestBase +from test.lib import engines # TODO: we should probably build mock bases for # these to share with test_reconnect, test_parseconnect diff --git a/test/dialect/test_mysql.py b/test/dialect/test_mysql.py index 499fd7bd2..7b06f412a 100644 --- a/test/dialect/test_mysql.py +++ b/test/dialect/test_mysql.py @@ -1,6 +1,6 @@ # coding: utf-8 -from sqlalchemy.test.testing import eq_, assert_raises +from test.lib.testing import eq_, assert_raises # Py2K import sets @@ -9,9 +9,9 @@ import sets from sqlalchemy import * from sqlalchemy import sql, exc, schema, types as sqltypes, event from sqlalchemy.dialects.mysql import base as mysql -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test import * -from sqlalchemy.test.engines import utf8_engine +from test.lib.testing import eq_ +from test.lib import * +from test.lib.engines import utf8_engine import datetime class TypesTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): diff --git a/test/dialect/test_oracle.py b/test/dialect/test_oracle.py index 6627015b9..3a0fbac9a 100644 --- a/test/dialect/test_oracle.py +++ b/test/dialect/test_oracle.py @@ -1,12 +1,12 @@ # coding: utf-8 -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy import * from sqlalchemy import types as sqltypes, exc from sqlalchemy.sql import table, column -from sqlalchemy.test import * -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message -from sqlalchemy.test.engines import testing_engine +from test.lib import * +from test.lib.testing import eq_, assert_raises, assert_raises_message +from test.lib.engines import testing_engine from sqlalchemy.dialects.oracle import cx_oracle, base as oracle from sqlalchemy.engine import default from sqlalchemy.util import jython diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 2baa65823..06a39ec26 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -1,6 +1,6 @@ # coding: utf-8 -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message -from sqlalchemy.test import engines +from test.lib.testing import eq_, assert_raises, assert_raises_message +from test.lib import engines import datetime import decimal from sqlalchemy import * @@ -8,10 +8,10 @@ from sqlalchemy.orm import * from sqlalchemy import exc, schema, types from sqlalchemy.dialects.postgresql import base as postgresql from sqlalchemy.engine.strategies import MockEngineStrategy -from sqlalchemy.test import * -from sqlalchemy.test.util import round_decimal +from test.lib import * +from test.lib.util import round_decimal from sqlalchemy.sql import table, column -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.engine._base import TablesTest import logging diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index d42e8dde9..34f5927ed 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -1,13 +1,13 @@ """SQLite-specific tests.""" -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message import datetime from sqlalchemy import * from sqlalchemy import exc, sql, schema, pool from sqlalchemy.dialects.sqlite import base as sqlite, \ pysqlite as pysqlite_dialect -from sqlalchemy.test import * +from test.lib import * class TestTypes(TestBase, AssertsExecutionResults): diff --git a/test/dialect/test_sybase.py b/test/dialect/test_sybase.py index 37de91d1c..54e4f32e1 100644 --- a/test/dialect/test_sybase.py +++ b/test/dialect/test_sybase.py @@ -1,7 +1,7 @@ from sqlalchemy import * from sqlalchemy import sql from sqlalchemy.databases import sybase -from sqlalchemy.test import * +from test.lib import * class CompileTest(TestBase, AssertsCompiledSQL): diff --git a/test/engine/_base.py b/test/engine/_base.py index ec91243d2..773fa2fea 100644 --- a/test/engine/_base.py +++ b/test/engine/_base.py @@ -1,6 +1,6 @@ import sqlalchemy as sa -from sqlalchemy.test import testing -from sqlalchemy.test.testing import adict +from test.lib import testing +from test.lib.testing import adict class TablesTest(testing.TestBase): diff --git a/test/engine/test_bind.py b/test/engine/test_bind.py index dfcc5e172..855c3611e 100644 --- a/test/engine/test_bind.py +++ b/test/engine/test_bind.py @@ -1,14 +1,14 @@ """tests the "bind" attribute/argument across schema and SQL, including the deprecated versions of these arguments""" -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy import engine, exc from sqlalchemy import MetaData, ThreadLocalMetaData from sqlalchemy import Integer, text -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing class BindTest(testing.TestBase): diff --git a/test/engine/test_ddlevents.py b/test/engine/test_ddlevents.py index d0e8af81d..733cc1fcf 100644 --- a/test/engine/test_ddlevents.py +++ b/test/engine/test_ddlevents.py @@ -1,13 +1,13 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy.schema import DDL, CheckConstraint, AddConstraint, \ DropConstraint from sqlalchemy import create_engine from sqlalchemy import MetaData, Integer, String, event, exc, text -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column import sqlalchemy as tsa -from sqlalchemy.test import TestBase, testing, engines -from sqlalchemy.test.testing import AssertsCompiledSQL, eq_ +from test.lib import TestBase, testing, engines +from test.lib.testing import AssertsCompiledSQL, eq_ from nose import SkipTest class DDLEventTest(TestBase): diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py index 7334f755a..6b0e86e2f 100644 --- a/test/engine/test_execute.py +++ b/test/engine/test_execute.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_, assert_raises +from test.lib.testing import eq_, assert_raises import re from sqlalchemy.interfaces import ConnectionProxy from sqlalchemy import MetaData, Integer, String, INT, VARCHAR, func, \ bindparam, select, event -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column import sqlalchemy as tsa -from sqlalchemy.test import TestBase, testing, engines +from test.lib import TestBase, testing, engines import logging from sqlalchemy.dialects.oracle.zxjdbc import ReturningParam diff --git a/test/engine/test_metadata.py b/test/engine/test_metadata.py index 1feb4d9e2..6534f67be 100644 --- a/test/engine/test_metadata.py +++ b/test/engine/test_metadata.py @@ -1,17 +1,17 @@ -from sqlalchemy.test.testing import assert_raises -from sqlalchemy.test.testing import assert_raises_message -from sqlalchemy.test.testing import emits_warning +from test.lib.testing import assert_raises +from test.lib.testing import assert_raises_message +from test.lib.testing import emits_warning import pickle from sqlalchemy import Integer, String, UniqueConstraint, \ CheckConstraint, ForeignKey, MetaData, Sequence, \ ForeignKeyConstraint, ColumnDefault, Index -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy import schema, exc import sqlalchemy as tsa -from sqlalchemy.test import TestBase, ComparesTables, \ +from test.lib import TestBase, ComparesTables, \ AssertsCompiledSQL, testing, engines -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ class MetaDataTest(TestBase, ComparesTables): def test_metadata_connect(self): diff --git a/test/engine/test_parseconnect.py b/test/engine/test_parseconnect.py index 78b75ad2f..7000549e7 100644 --- a/test/engine/test_parseconnect.py +++ b/test/engine/test_parseconnect.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message, eq_ +from test.lib.testing import assert_raises, assert_raises_message, eq_ import ConfigParser import StringIO import sqlalchemy.engine.url as url from sqlalchemy import create_engine, engine_from_config from sqlalchemy.engine import _coerce_config import sqlalchemy as tsa -from sqlalchemy.test import TestBase +from test.lib import TestBase class ParseConnectTest(TestBase): diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py index 06c9ac065..4da3a08e3 100644 --- a/test/engine/test_pool.py +++ b/test/engine/test_pool.py @@ -1,9 +1,9 @@ import threading, time from sqlalchemy import pool, interfaces, create_engine, select, event import sqlalchemy as tsa -from sqlalchemy.test import TestBase, testing -from sqlalchemy.test.util import gc_collect, lazy_gc -from sqlalchemy.test.testing import eq_ +from test.lib import TestBase, testing +from test.lib.util import gc_collect, lazy_gc +from test.lib.testing import eq_ mcid = 1 class MockDBAPI(object): diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py index 7675de9c3..e28985801 100644 --- a/test/engine/test_reconnect.py +++ b/test/engine/test_reconnect.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_, assert_raises +from test.lib.testing import eq_, assert_raises import time import weakref from sqlalchemy import select, MetaData, Integer, String, pool -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column import sqlalchemy as tsa -from sqlalchemy.test import TestBase, testing, engines -from sqlalchemy.test.util import gc_collect +from test.lib import TestBase, testing, engines +from test.lib.util import gc_collect from sqlalchemy import exc class MockDisconnect(Exception): diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index 91e73d4f2..5fd18dc81 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -1,12 +1,12 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import StringIO, unicodedata from sqlalchemy import types as sql_types from sqlalchemy import schema from sqlalchemy.engine.reflection import Inspector from sqlalchemy import MetaData -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column import sqlalchemy as sa -from sqlalchemy.test import TestBase, ComparesTables, \ +from test.lib import TestBase, ComparesTables, \ testing, engines, AssertsCompiledSQL create_inspector = Inspector.from_engine diff --git a/test/engine/test_transaction.py b/test/engine/test_transaction.py index 6f3186add..14d8bfd1b 100644 --- a/test/engine/test_transaction.py +++ b/test/engine/test_transaction.py @@ -1,13 +1,13 @@ -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message import sys import time import threading from sqlalchemy import create_engine, MetaData, INT, VARCHAR, Sequence, \ select, Integer, String, func, text, exc -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column -from sqlalchemy.test import TestBase, testing +from test.lib.schema import Table +from test.lib.schema import Column +from test.lib import TestBase, testing users, metadata = None, None diff --git a/test/ex/test_examples.py b/test/ex/test_examples.py index 9c68f1825..311eab041 100644 --- a/test/ex/test_examples.py +++ b/test/ex/test_examples.py @@ -1,4 +1,4 @@ -from sqlalchemy.test import * +from test.lib import * import os import re diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py index d22e45796..fb2f60ff1 100644 --- a/test/ext/test_associationproxy.py +++ b/test/ext/test_associationproxy.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import eq_, assert_raises +from test.lib.testing import eq_, assert_raises import copy import pickle @@ -7,8 +7,8 @@ from sqlalchemy.orm import * from sqlalchemy.orm.collections import collection from sqlalchemy.ext.associationproxy import * from sqlalchemy.ext.associationproxy import _AssociationList -from sqlalchemy.test import * -from sqlalchemy.test.util import gc_collect +from test.lib import * +from test.lib.util import gc_collect from sqlalchemy.sql import not_ from test.orm import _base diff --git a/test/ext/test_compiler.py b/test/ext/test_compiler.py index 3ed84fe61..31b893b48 100644 --- a/test/ext/test_compiler.py +++ b/test/ext/test_compiler.py @@ -5,7 +5,7 @@ from sqlalchemy.sql.expression import ClauseElement, ColumnClause,\ from sqlalchemy.schema import DDLElement from sqlalchemy.ext.compiler import compiles from sqlalchemy.sql import table, column -from sqlalchemy.test import * +from test.lib import * class UserDefinedTest(TestBase, AssertsCompiledSQL): diff --git a/test/ext/test_declarative.py b/test/ext/test_declarative.py index 32173cdc1..85692161b 100644 --- a/test/ext/test_declarative.py +++ b/test/ext/test_declarative.py @@ -1,17 +1,17 @@ -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message from sqlalchemy.ext import declarative as decl from sqlalchemy import exc import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import MetaData, Integer, String, ForeignKey, \ ForeignKeyConstraint, asc, Index -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import relationship, create_session, class_mapper, \ joinedload, configure_mappers, backref, clear_mappers, \ polymorphic_union, deferred, column_property -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy.util import classproperty from test.orm._base import ComparableEntity, MappedTest from sqlalchemy.ext.declarative import declared_attr diff --git a/test/ext/test_horizontal_shard.py b/test/ext/test_horizontal_shard.py index a5cee5cad..b4f60519c 100644 --- a/test/ext/test_horizontal_shard.py +++ b/test/ext/test_horizontal_shard.py @@ -4,8 +4,8 @@ from sqlalchemy import sql from sqlalchemy.orm import * from sqlalchemy.ext.horizontal_shard import ShardedSession from sqlalchemy.sql import operators -from sqlalchemy.test import * -from sqlalchemy.test.testing import eq_ +from test.lib import * +from test.lib.testing import eq_ from nose import SkipTest # TODO: ShardTest can be turned into a base for further subclasses diff --git a/test/ext/test_orderinglist.py b/test/ext/test_orderinglist.py index 559aefd1d..f7f8f7fa7 100644 --- a/test/ext/test_orderinglist.py +++ b/test/ext/test_orderinglist.py @@ -1,8 +1,8 @@ from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.orderinglist import * -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test import * +from test.lib.testing import eq_ +from test.lib import * metadata = None diff --git a/test/ext/test_serializer.py b/test/ext/test_serializer.py index 24626bc8e..862a871af 100644 --- a/test/ext/test_serializer.py +++ b/test/ext/test_serializer.py @@ -2,14 +2,14 @@ from sqlalchemy.ext import serializer from sqlalchemy import exc import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import MetaData, Integer, String, ForeignKey, select, \ desc, func, util -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import relationship, sessionmaker, scoped_session, \ class_mapper, mapper, joinedload, configure_mappers, aliased -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm._base import ComparableEntity, MappedTest diff --git a/test/ext/test_sqlsoup.py b/test/ext/test_sqlsoup.py index 7fe8ab178..f0ac6cbed 100644 --- a/test/ext/test_sqlsoup.py +++ b/test/ext/test_sqlsoup.py @@ -1,5 +1,5 @@ from sqlalchemy.ext import sqlsoup -from sqlalchemy.test.testing import TestBase, eq_, assert_raises +from test.lib.testing import TestBase, eq_, assert_raises from sqlalchemy import create_engine, or_, desc, select, func, exc, \ Table, util from sqlalchemy.orm import scoped_session, sessionmaker diff --git a/lib/sqlalchemy/test/__init__.py b/test/lib/__init__.py index 7356945d2..452848aff 100644 --- a/lib/sqlalchemy/test/__init__.py +++ b/test/lib/__init__.py @@ -6,10 +6,10 @@ by noseplugin.NoseSQLAlchemy. """ -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 \ +from test.bootstrap import config +from test.lib import testing, engines, requires, profiling, pickleable +from test.lib.schema import Column, Table +from test.lib.testing import \ AssertsCompiledSQL, \ AssertsExecutionResults, \ ComparesTables, \ diff --git a/lib/sqlalchemy/test/assertsql.py b/test/lib/assertsql.py index dee63a876..b206f91fc 100644 --- a/lib/sqlalchemy/test/assertsql.py +++ b/test/lib/assertsql.py @@ -6,35 +6,40 @@ from sqlalchemy import util import re class AssertRule(object): + def process_execute(self, clauseelement, *multiparams, **params): pass - def process_cursor_execute(self, statement, parameters, context, executemany): + def process_cursor_execute(self, statement, parameters, context, + executemany): pass - + def is_consumed(self): """Return True if this rule has been consumed, False if not. - Should raise an AssertionError if this rule's condition has definitely failed. + Should raise an AssertionError if this rule's condition has + definitely failed. """ + raise NotImplementedError() - + def rule_passed(self): - """Return True if the last test of this rule passed, False if failed, None if no test was applied.""" - + """Return True if the last test of this rule passed, False if + failed, None if no test was applied.""" + raise NotImplementedError() - + def consume_final(self): """Return True if this rule has been consumed. - Should raise an AssertionError if this rule's condition has not been consumed or has failed. + Should raise an AssertionError if this rule's condition has not + been consumed or has failed. """ - + if self._result is None: - assert False, "Rule has not been consumed" - + assert False, 'Rule has not been consumed' return self.is_consumed() class SQLMatchRule(AssertRule): @@ -54,67 +59,72 @@ class SQLMatchRule(AssertRule): return True class ExactSQL(SQLMatchRule): + def __init__(self, sql, params=None): SQLMatchRule.__init__(self) self.sql = sql self.params = params - - def process_cursor_execute(self, statement, parameters, context, executemany): + + def process_cursor_execute(self, statement, parameters, context, + executemany): if not context: return - - _received_statement = _process_engine_statement(context.unicode_statement, context) + _received_statement = \ + _process_engine_statement(context.unicode_statement, + context) _received_parameters = context.compiled_parameters - - # TODO: remove this step once all unit tests - # are migrated, as ExactSQL should really be *exact* SQL + + # TODO: remove this step once all unit tests are migrated, as + # ExactSQL should really be *exact* SQL + sql = _process_assertion_statement(self.sql, context) - equivalent = _received_statement == sql if self.params: if util.callable(self.params): params = self.params(context) else: params = self.params - if not isinstance(params, list): params = [params] - equivalent = equivalent and params == context.compiled_parameters + equivalent = equivalent and params \ + == context.compiled_parameters else: params = {} - - self._result = equivalent if not self._result: - self._errmsg = "Testing for exact statement %r exact params %r, " \ - "received %r with params %r" % (sql, params, _received_statement, _received_parameters) + self._errmsg = \ + 'Testing for exact statement %r exact params %r, '\ + 'received %r with params %r' % (sql, params, + _received_statement, _received_parameters) class RegexSQL(SQLMatchRule): + def __init__(self, regex, params=None): SQLMatchRule.__init__(self) self.regex = re.compile(regex) self.orig_regex = regex self.params = params - def process_cursor_execute(self, statement, parameters, context, executemany): + def process_cursor_execute(self, statement, parameters, context, + executemany): if not context: return - - _received_statement = _process_engine_statement(context.unicode_statement, context) + _received_statement = \ + _process_engine_statement(context.unicode_statement, + context) _received_parameters = context.compiled_parameters - equivalent = bool(self.regex.match(_received_statement)) if self.params: if util.callable(self.params): params = self.params(context) else: params = self.params - if not isinstance(params, list): params = [params] - + # do a positive compare only + for param, received in zip(params, _received_parameters): for k, v in param.iteritems(): if k not in received or received[k] != v: @@ -122,47 +132,47 @@ class RegexSQL(SQLMatchRule): break else: params = {} - self._result = equivalent if not self._result: - self._errmsg = "Testing for regex %r partial params %r, "\ - "received %r with params %r" % (self.orig_regex, params, _received_statement, _received_parameters) + self._errmsg = \ + 'Testing for regex %r partial params %r, received %r '\ + 'with params %r' % (self.orig_regex, params, + _received_statement, + _received_parameters) class CompiledSQL(SQLMatchRule): + def __init__(self, statement, params): SQLMatchRule.__init__(self) self.statement = statement self.params = params - def process_cursor_execute(self, statement, parameters, context, executemany): + def process_cursor_execute(self, statement, parameters, context, + executemany): if not context: return - _received_parameters = list(context.compiled_parameters) - + # recompile from the context, using the default dialect - compiled = context.compiled.statement.\ - compile(dialect=DefaultDialect(), column_keys=context.compiled.column_keys) - + + compiled = \ + context.compiled.statement.compile(dialect=DefaultDialect(), + column_keys=context.compiled.column_keys) _received_statement = re.sub(r'\n', '', str(compiled)) - equivalent = self.statement == _received_statement if self.params: if util.callable(self.params): params = self.params(context) else: params = self.params - if not isinstance(params, list): params = [params] - all_params = list(params) all_received = list(_received_parameters) while params: param = dict(params.pop(0)) for k, v in context.compiled.params.iteritems(): param.setdefault(k, v) - if param not in _received_parameters: equivalent = False break @@ -172,72 +182,78 @@ class CompiledSQL(SQLMatchRule): equivalent = False else: params = {} - self._result = equivalent if not self._result: - print "Testing for compiled statement %r partial params %r, " \ - "received %r with params %r" % \ - (self.statement, all_params, _received_statement, all_received) - - self._errmsg = "Testing for compiled statement %r partial params %r, " \ - "received %r with params %r" % \ - (self.statement, all_params, _received_statement, all_received) - #print self._errmsg + print 'Testing for compiled statement %r partial params '\ + '%r, received %r with params %r' % (self.statement, + all_params, _received_statement, all_received) + self._errmsg = \ + 'Testing for compiled statement %r partial params %r, '\ + 'received %r with params %r' % (self.statement, + all_params, _received_statement, all_received) + + + # print self._errmsg - class CountStatements(AssertRule): + def __init__(self, count): self.count = count self._statement_count = 0 - + def process_execute(self, clauseelement, *multiparams, **params): self._statement_count += 1 - def process_cursor_execute(self, statement, parameters, context, executemany): + def process_cursor_execute(self, statement, parameters, context, + executemany): pass def is_consumed(self): return False - + def consume_final(self): - assert self.count == self._statement_count, "desired statement count %d does not match %d" % (self.count, self._statement_count) + assert self.count == self._statement_count, \ + 'desired statement count %d does not match %d' \ + % (self.count, self._statement_count) return True class AllOf(AssertRule): + def __init__(self, *rules): self.rules = set(rules) - + def process_execute(self, clauseelement, *multiparams, **params): for rule in self.rules: rule.process_execute(clauseelement, *multiparams, **params) - def process_cursor_execute(self, statement, parameters, context, executemany): + def process_cursor_execute(self, statement, parameters, context, + executemany): for rule in self.rules: - rule.process_cursor_execute(statement, parameters, context, executemany) + rule.process_cursor_execute(statement, parameters, context, + executemany) def is_consumed(self): if not self.rules: return True - for rule in list(self.rules): - if rule.rule_passed(): # a rule passed, move on + if rule.rule_passed(): # a rule passed, move on self.rules.remove(rule) return len(self.rules) == 0 + assert False, 'No assertion rules were satisfied for statement' - assert False, "No assertion rules were satisfied for statement" - def consume_final(self): return len(self.rules) == 0 def _process_engine_statement(query, context): if util.jython: + # oracle+zxjdbc passes a PyStatement when returning into + query = unicode(query) - if context.engine.name == 'mssql' and query.endswith('; select scope_identity()'): + if context.engine.name == 'mssql' \ + and query.endswith('; select scope_identity()'): query = query[:-25] - query = re.sub(r'\n', '', query) - return query def _process_assertion_statement(query, context): @@ -260,33 +276,39 @@ def _process_assertion_statement(query, context): return query class SQLAssert(object): + rules = None - + def add_rules(self, rules): self.rules = list(rules) - + def statement_complete(self): for rule in self.rules: if not rule.consume_final(): - assert False, "All statements are complete, but pending assertion rules remain" + assert False, \ + 'All statements are complete, but pending '\ + 'assertion rules remain' def clear_rules(self): del self.rules - + def execute(self, conn, clauseelement, multiparams, params, result): if self.rules is not None: if not self.rules: - assert False, "All rules have been exhausted, but further statements remain" + assert False, \ + 'All rules have been exhausted, but further '\ + 'statements remain' rule = self.rules[0] rule.process_execute(clauseelement, *multiparams, **params) if rule.is_consumed(): self.rules.pop(0) - - - def cursor_execute(self, conn, cursor, statement, parameters, context, executemany): + + def cursor_execute(self, conn, cursor, statement, parameters, + context, executemany): if self.rules: rule = self.rules[0] - rule.process_cursor_execute(statement, parameters, context, executemany) + rule.process_cursor_execute(statement, parameters, context, + executemany) asserter = SQLAssert() diff --git a/lib/sqlalchemy/test/engines.py b/test/lib/engines.py index acae1d28a..fdf4163c8 100644 --- a/lib/sqlalchemy/test/engines.py +++ b/test/lib/engines.py @@ -1,6 +1,6 @@ import sys, types, weakref from collections import deque -from sqlalchemy_nose import config +from test.bootstrap import config from sqlalchemy.util import function_named, callable from sqlalchemy import event import re @@ -129,7 +129,7 @@ def testing_engine(url=None, options=None): """Produce an engine configured by --options with optional overrides.""" from sqlalchemy import create_engine - from sqlalchemy.test.assertsql import asserter + from test.lib.assertsql import asserter url = url or config.db_url options = options or config.db_opts diff --git a/lib/sqlalchemy/test/entities.py b/test/lib/entities.py index 0ec677eea..0ec677eea 100644 --- a/lib/sqlalchemy/test/entities.py +++ b/test/lib/entities.py diff --git a/lib/sqlalchemy/test/orm.py b/test/lib/orm.py index 7ec13c555..7ec13c555 100644 --- a/lib/sqlalchemy/test/orm.py +++ b/test/lib/orm.py diff --git a/lib/sqlalchemy/test/pickleable.py b/test/lib/pickleable.py index 9794e424d..9794e424d 100644 --- a/lib/sqlalchemy/test/pickleable.py +++ b/test/lib/pickleable.py diff --git a/lib/sqlalchemy/test/profiling.py b/test/lib/profiling.py index 835253a3a..f6c21bde8 100644 --- a/lib/sqlalchemy/test/profiling.py +++ b/test/lib/profiling.py @@ -6,8 +6,7 @@ in a more fine-grained way than nose's profiling plugin. """ import os, sys -from sqlalchemy_nose import config -from sqlalchemy.test.util import function_named, gc_collect +from test.lib.util import function_named, gc_collect from nose import SkipTest __all__ = 'profiled', 'function_call_count', 'conditional_call_count' diff --git a/lib/sqlalchemy/test/requires.py b/test/lib/requires.py index 08fde66c3..08fde66c3 100644 --- a/lib/sqlalchemy/test/requires.py +++ b/test/lib/requires.py diff --git a/lib/sqlalchemy/test/schema.py b/test/lib/schema.py index d33d75e2c..614e5863e 100644 --- a/lib/sqlalchemy/test/schema.py +++ b/test/lib/schema.py @@ -2,7 +2,7 @@ desired state for different backends. """ -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import schema __all__ = 'Table', 'Column', diff --git a/lib/sqlalchemy/test/testing.py b/test/lib/testing.py index 12cbe5e02..da2a3dfd3 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/test/lib/testing.py @@ -8,8 +8,8 @@ import types import warnings from cStringIO import StringIO -from sqlalchemy_nose import config -from sqlalchemy.test import assertsql, util as testutil +from test.bootstrap import config +from test.lib import assertsql, util as testutil from sqlalchemy.util import function_named, py3k from engines import drop_all_tables diff --git a/lib/sqlalchemy/test/util.py b/test/lib/util.py index e5277f076..e5277f076 100644 --- a/lib/sqlalchemy/test/util.py +++ b/test/lib/util.py diff --git a/test/orm/_base.py b/test/orm/_base.py index 4d0031f5a..4ccc10157 100644 --- a/test/orm/_base.py +++ b/test/orm/_base.py @@ -3,11 +3,11 @@ import sys import types import sqlalchemy as sa import sqlalchemy.exceptions as sa_exc -from sqlalchemy.test import config, testing -from sqlalchemy.test.testing import resolve_artifact_names, adict -from sqlalchemy.test.engines import drop_all_tables +from test.lib import config, testing +from test.lib.testing import resolve_artifact_names, adict +from test.lib.engines import drop_all_tables from sqlalchemy.util import function_named -from sqlalchemy.test.entities import BasicEntity, ComparableEntity +from test.lib.entities import BasicEntity, ComparableEntity Entity = BasicEntity diff --git a/test/orm/_fixtures.py b/test/orm/_fixtures.py index a8df63b4a..8f128c287 100644 --- a/test/orm/_fixtures.py +++ b/test/orm/_fixtures.py @@ -1,8 +1,8 @@ from sqlalchemy import MetaData, Integer, String, ForeignKey -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import attributes -from sqlalchemy.test.testing import fixture +from test.lib.testing import fixture from test.orm import _base __all__ = () diff --git a/test/orm/inheritance/test_abc_inheritance.py b/test/orm/inheritance/test_abc_inheritance.py index edbd476ec..08ab28a08 100644 --- a/test/orm/inheritance/test_abc_inheritance.py +++ b/test/orm/inheritance/test_abc_inheritance.py @@ -2,8 +2,8 @@ from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm.interfaces import ONETOMANY, MANYTOONE -from sqlalchemy.test import testing -from sqlalchemy.test.schema import Table, Column +from test.lib import testing +from test.lib.schema import Table, Column from test.orm import _base diff --git a/test/orm/inheritance/test_abc_polymorphic.py b/test/orm/inheritance/test_abc_polymorphic.py index 2dab59bb2..fb229003b 100644 --- a/test/orm/inheritance/test_abc_polymorphic.py +++ b/test/orm/inheritance/test_abc_polymorphic.py @@ -4,7 +4,7 @@ from sqlalchemy.orm import * from sqlalchemy.util import function_named from test.orm import _base, _fixtures -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column class ABCTest(_base.MappedTest): @classmethod diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index c57f1d095..5892b3c89 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -1,14 +1,14 @@ import warnings -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy import exc as sa_exc, util from sqlalchemy.orm import * from sqlalchemy.orm import exc as orm_exc -from sqlalchemy.test import testing, engines +from test.lib import testing, engines from sqlalchemy.util import function_named from test.orm import _base, _fixtures -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column class O2MTest(_base.MappedTest): """deals with inheritance and one-to-many relationships""" diff --git a/test/orm/inheritance/test_concrete.py b/test/orm/inheritance/test_concrete.py index a2d79284c..43ba36ace 100644 --- a/test/orm/inheritance/test_concrete.py +++ b/test/orm/inheritance/test_concrete.py @@ -1,15 +1,15 @@ -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm import exc as orm_exc -from sqlalchemy.test import * +from test.lib import * import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from test.orm import _base from sqlalchemy.orm import attributes -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test.schema import Table, Column +from test.lib.testing import eq_ +from test.lib.schema import Table, Column class Employee(object): diff --git a/test/orm/inheritance/test_magazine.py b/test/orm/inheritance/test_magazine.py index 125a5629c..307c54a9c 100644 --- a/test/orm/inheritance/test_magazine.py +++ b/test/orm/inheritance/test_magazine.py @@ -1,10 +1,10 @@ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy.util import function_named from test.orm import _base -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column class BaseObject(object): def __init__(self, *args, **kwargs): diff --git a/test/orm/inheritance/test_manytomany.py b/test/orm/inheritance/test_manytomany.py index 8390e2a1b..f5e3e63a1 100644 --- a/test/orm/inheritance/test_manytomany.py +++ b/test/orm/inheritance/test_manytomany.py @@ -1,8 +1,8 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import testing +from test.lib import testing from test.orm import _base diff --git a/test/orm/inheritance/test_poly_linked_list.py b/test/orm/inheritance/test_poly_linked_list.py index 01dad72e4..8b300f06a 100644 --- a/test/orm/inheritance/test_poly_linked_list.py +++ b/test/orm/inheritance/test_poly_linked_list.py @@ -2,8 +2,8 @@ from sqlalchemy import * from sqlalchemy.orm import * from test.orm import _base -from sqlalchemy.test import testing -from sqlalchemy.test.schema import Table, Column +from test.lib import testing +from test.lib.schema import Table, Column class PolymorphicCircularTest(_base.MappedTest): diff --git a/test/orm/inheritance/test_polymorph.py b/test/orm/inheritance/test_polymorph.py index 33646c922..1f82834d9 100644 --- a/test/orm/inheritance/test_polymorph.py +++ b/test/orm/inheritance/test_polymorph.py @@ -1,11 +1,11 @@ """tests basic polymorphic mapper loading/saving, minimal relationships""" -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm import exc as orm_exc from sqlalchemy import exc as sa_exc -from sqlalchemy.test import Column, testing +from test.lib import Column, testing from sqlalchemy.util import function_named from test.orm import _fixtures, _base diff --git a/test/orm/inheritance/test_polymorph2.py b/test/orm/inheritance/test_polymorph2.py index 9852e8b09..030b931a5 100644 --- a/test/orm/inheritance/test_polymorph2.py +++ b/test/orm/inheritance/test_polymorph2.py @@ -2,16 +2,16 @@ inheritance setups for which we maintain compatibility. """ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy import * from sqlalchemy import util from sqlalchemy.orm import * -from sqlalchemy.test import TestBase, AssertsExecutionResults, testing +from test.lib import TestBase, AssertsExecutionResults, testing from sqlalchemy.util import function_named from test.orm import _base, _fixtures -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test.schema import Table, Column +from test.lib.testing import eq_ +from test.lib.schema import Table, Column class AttrSettable(object): def __init__(self, **kwargs): diff --git a/test/orm/inheritance/test_productspec.py b/test/orm/inheritance/test_productspec.py index dc81d9245..a1ecf2562 100644 --- a/test/orm/inheritance/test_productspec.py +++ b/test/orm/inheritance/test_productspec.py @@ -2,9 +2,9 @@ from datetime import datetime from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import testing +from test.lib import testing from test.orm import _base -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column class InheritTest(_base.MappedTest): """tests some various inheritance round trips involving a particular set of polymorphic inheritance relationships""" diff --git a/test/orm/inheritance/test_query.py b/test/orm/inheritance/test_query.py index 45b3e9da1..36a23204d 100644 --- a/test/orm/inheritance/test_query.py +++ b/test/orm/inheritance/test_query.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm import interfaces @@ -6,10 +6,10 @@ from sqlalchemy import exc as sa_exc from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.engine import default -from sqlalchemy.test import AssertsCompiledSQL, testing +from test.lib import AssertsCompiledSQL, testing from test.orm import _base, _fixtures -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test.schema import Table, Column +from test.lib.testing import eq_ +from test.lib.schema import Table, Column class Company(_fixtures.Base): pass diff --git a/test/orm/inheritance/test_selects.py b/test/orm/inheritance/test_selects.py index 7c9920f6f..5a7389386 100644 --- a/test/orm/inheritance/test_selects.py +++ b/test/orm/inheritance/test_selects.py @@ -1,7 +1,7 @@ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import testing +from test.lib import testing from test.orm._fixtures import Base from test.orm._base import MappedTest diff --git a/test/orm/inheritance/test_single.py b/test/orm/inheritance/test_single.py index 2efde2b32..a65851a5f 100644 --- a/test/orm/inheritance/test_single.py +++ b/test/orm/inheritance/test_single.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import testing +from test.lib import testing from test.orm import _fixtures from test.orm._base import MappedTest, ComparableEntity -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column class SingleInheritanceTest(testing.AssertsCompiledSQL, MappedTest): diff --git a/test/orm/test_association.py b/test/orm/test_association.py index c9b1584bb..e681099c5 100644 --- a/test/orm/test_association.py +++ b/test/orm/test_association.py @@ -1,10 +1,10 @@ -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session from test.orm import _base -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ class AssociationTest(_base.MappedTest): diff --git a/test/orm/test_assorted_eager.py b/test/orm/test_assorted_eager.py index ff9234d70..b11b3ddd9 100644 --- a/test/orm/test_assorted_eager.py +++ b/test/orm/test_assorted_eager.py @@ -9,11 +9,11 @@ be cleaned up and modernized. import datetime import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, backref, create_session -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py index b5a6c1f5e..913c6ec52 100644 --- a/test/orm/test_attributes.py +++ b/test/orm/test_attributes.py @@ -3,10 +3,10 @@ from sqlalchemy.orm import attributes, instrumentation from sqlalchemy.orm.collections import collection from sqlalchemy.orm.interfaces import AttributeExtension from sqlalchemy import exc as sa_exc -from sqlalchemy.test import * -from sqlalchemy.test.testing import eq_, ne_, assert_raises +from test.lib import * +from test.lib.testing import eq_, ne_, assert_raises from test.orm import _base -from sqlalchemy.test.util import gc_collect, all_partial_orderings +from test.lib.util import gc_collect, all_partial_orderings from sqlalchemy.util import cmp, jython from sqlalchemy import event, topological diff --git a/test/orm/test_backref_mutations.py b/test/orm/test_backref_mutations.py index dd48df592..31cab962e 100644 --- a/test/orm/test_backref_mutations.py +++ b/test/orm/test_backref_mutations.py @@ -9,14 +9,14 @@ UPDATE in the database. """ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy import Integer, String, ForeignKey, Sequence, exc as sa_exc -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, create_session, class_mapper, backref, sessionmaker from sqlalchemy.orm import attributes, exc as orm_exc -from sqlalchemy.test import testing -from sqlalchemy.test.testing import eq_ +from test.lib import testing +from test.lib.testing import eq_ from test.orm import _base, _fixtures class O2MCollectionTest(_fixtures.FixtureTest): diff --git a/test/orm/test_bind.py b/test/orm/test_bind.py index 9b1c20b60..bab9be428 100644 --- a/test/orm/test_bind.py +++ b/test/orm/test_bind.py @@ -1,10 +1,10 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy import MetaData, Integer -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, create_session import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from test.orm import _base diff --git a/test/orm/test_cascade.py b/test/orm/test_cascade.py index bedff2170..17b186cd8 100644 --- a/test/orm/test_cascade.py +++ b/test/orm/test_cascade.py @@ -1,13 +1,13 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy import Integer, String, ForeignKey, Sequence, \ exc as sa_exc -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session, \ sessionmaker, class_mapper, backref, Session from sqlalchemy.orm import attributes, exc as orm_exc -from sqlalchemy.test import testing -from sqlalchemy.test.testing import eq_ +from test.lib import testing +from test.lib.testing import eq_ from test.orm import _base, _fixtures diff --git a/test/orm/test_collection.py b/test/orm/test_collection.py index b0ce28663..540213745 100644 --- a/test/orm/test_collection.py +++ b/test/orm/test_collection.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import sys from operator import and_ @@ -6,14 +6,14 @@ import sqlalchemy.orm.collections as collections from sqlalchemy.orm.collections import collection import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, text -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy import util, exc as sa_exc from sqlalchemy.orm import create_session, mapper, relationship, \ attributes, instrumentation from test.orm import _base -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message class Canary(sa.orm.interfaces.AttributeExtension): def __init__(self): diff --git a/test/orm/test_compile.py b/test/orm/test_compile.py index 575c3ccfb..3294a853c 100644 --- a/test/orm/test_compile.py +++ b/test/orm/test_compile.py @@ -1,8 +1,8 @@ from sqlalchemy import * from sqlalchemy import exc as sa_exc from sqlalchemy.orm import * -from sqlalchemy.test import * -from sqlalchemy.test.testing import assert_raises_message +from test.lib import * +from test.lib.testing import assert_raises_message from test.orm import _base diff --git a/test/orm/test_cycles.py b/test/orm/test_cycles.py index 26765244a..e5e657933 100644 --- a/test/orm/test_cycles.py +++ b/test/orm/test_cycles.py @@ -5,13 +5,13 @@ T1<->T2, with o2m or m2o between them, and a third T3 with o2m/m2o to one/both T1/T2. """ -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, backref, \ create_session, sessionmaker -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test.assertsql import RegexSQL, ExactSQL, CompiledSQL, AllOf +from test.lib.testing import eq_ +from test.lib.assertsql import RegexSQL, ExactSQL, CompiledSQL, AllOf from test.orm import _base diff --git a/test/orm/test_defaults.py b/test/orm/test_defaults.py index 389fdbc5c..e5f419ccb 100644 --- a/test/orm/test_defaults.py +++ b/test/orm/test_defaults.py @@ -1,11 +1,11 @@ import sqlalchemy as sa -from sqlalchemy.test import testing from sqlalchemy import Integer, String, ForeignKey, event -from sqlalchemy.test.schema import Table, Column +from test.lib import testing +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session from test.orm import _base -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ class TriggerDefaultsTest(_base.MappedTest): diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py index 76c59d029..2565105a6 100644 --- a/test/orm/test_deprecations.py +++ b/test/orm/test_deprecations.py @@ -5,10 +5,10 @@ modern (i.e. not deprecated) alternative to them. The tests snippets here can be migrated directly to the wiki, docs, etc. """ -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, func -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, relation, create_session, sessionmaker from test.orm import _base diff --git a/test/orm/test_dynamic.py b/test/orm/test_dynamic.py index c06f6918a..c89503278 100644 --- a/test/orm/test_dynamic.py +++ b/test/orm/test_dynamic.py @@ -1,12 +1,12 @@ -from sqlalchemy.test.testing import eq_, ne_ +from test.lib.testing import eq_, ne_ import operator from sqlalchemy.orm import dynamic_loader, backref -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, desc, select, func -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session, Query, attributes from sqlalchemy.orm.dynamic import AppenderMixin -from sqlalchemy.test.testing import eq_, AssertsCompiledSQL, assert_raises_message +from test.lib.testing import eq_, AssertsCompiledSQL, assert_raises_message from sqlalchemy.util import function_named from test.orm import _base, _fixtures diff --git a/test/orm/test_eager_relations.py b/test/orm/test_eager_relations.py index 94d1b3464..6304ae45a 100644 --- a/test/orm/test_eager_relations.py +++ b/test/orm/test_eager_relations.py @@ -1,18 +1,18 @@ """tests of joined-eager loaded attributes""" -from sqlalchemy.test.testing import eq_, is_, is_not_ +from test.lib.testing import eq_, is_, is_not_ import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy.orm import joinedload, deferred, undefer, \ joinedload_all, backref from sqlalchemy import Integer, String, Date, ForeignKey, and_, select, \ func -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session, \ lazyload, aliased -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message -from sqlalchemy.test.assertsql import CompiledSQL +from test.lib.assertsql import CompiledSQL from test.orm import _base, _fixtures from sqlalchemy.util import OrderedDict as odict import datetime diff --git a/test/orm/test_evaluator.py b/test/orm/test_evaluator.py index af6a3f89e..26f9f49c3 100644 --- a/test/orm/test_evaluator.py +++ b/test/orm/test_evaluator.py @@ -1,11 +1,11 @@ """Evluating SQL expressions on ORM objects""" import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import String, Integer, select -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, create_session -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base from sqlalchemy import and_, or_, not_ diff --git a/test/orm/test_expire.py b/test/orm/test_expire.py index 0d9f5e745..7189290bc 100644 --- a/test/orm/test_expire.py +++ b/test/orm/test_expire.py @@ -1,12 +1,12 @@ """Attribute/instance expiration, deferral of attributes, etc.""" -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message -from sqlalchemy.test.util import gc_collect +from test.lib.testing import eq_, assert_raises, assert_raises_message +from test.lib.util import gc_collect import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, exc as sa_exc -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, create_session, \ attributes, deferred, exc as orm_exc, defer, undefer,\ strategies, state, lazyload, backref diff --git a/test/orm/test_extendedattr.py b/test/orm/test_extendedattr.py index 6fabe7e43..aae1ecdbb 100644 --- a/test/orm/test_extendedattr.py +++ b/test/orm/test_extendedattr.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import pickle from sqlalchemy import util from sqlalchemy.orm import attributes, instrumentation @@ -7,7 +7,7 @@ from sqlalchemy.orm.attributes import set_attribute, get_attribute, del_attribut from sqlalchemy.orm.instrumentation import is_instrumented from sqlalchemy.orm import clear_mappers from sqlalchemy.orm import InstrumentationManager -from sqlalchemy.test import * +from test.lib import * from test.orm import _base class MyTypesManager(InstrumentationManager): diff --git a/test/orm/test_generative.py b/test/orm/test_generative.py index 73f62b233..e3c5eee99 100644 --- a/test/orm/test_generative.py +++ b/test/orm/test_generative.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, MetaData, func -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, create_session -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base, _fixtures diff --git a/test/orm/test_immediate_load.py b/test/orm/test_immediate_load.py index f85208bff..66794ad4b 100644 --- a/test/orm/test_immediate_load.py +++ b/test/orm/test_immediate_load.py @@ -1,8 +1,8 @@ """basic tests of lazy loaded attributes""" -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy.orm import mapper, relationship, create_session, immediateload -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _fixtures diff --git a/test/orm/test_instrumentation.py b/test/orm/test_instrumentation.py index 7ffee2a2e..4bcf36351 100644 --- a/test/orm/test_instrumentation.py +++ b/test/orm/test_instrumentation.py @@ -1,12 +1,12 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import sqlalchemy as sa from sqlalchemy import MetaData, Integer, ForeignKey, util, event -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column from sqlalchemy.orm import mapper, relationship, create_session, \ attributes, class_mapper, clear_mappers, instrumentation, events -from sqlalchemy.test.testing import eq_, ne_ +from test.lib.schema import Table +from test.lib.schema import Column +from test.lib.testing import eq_, ne_ from sqlalchemy.util import function_named from test.orm import _base diff --git a/test/orm/test_lazy_relations.py b/test/orm/test_lazy_relations.py index f6147a3eb..1bf7eecaf 100644 --- a/test/orm/test_lazy_relations.py +++ b/test/orm/test_lazy_relations.py @@ -1,17 +1,17 @@ """basic tests of lazy loaded attributes""" -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import datetime from sqlalchemy import exc as sa_exc from sqlalchemy.orm import attributes, exc as orm_exc import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, SmallInteger from sqlalchemy.types import TypeDecorator -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, create_session -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base, _fixtures diff --git a/test/orm/test_load_on_fks.py b/test/orm/test_load_on_fks.py index 8e4f53b0d..3e7ddb8c2 100644 --- a/test/orm/test_load_on_fks.py +++ b/test/orm/test_load_on_fks.py @@ -2,11 +2,11 @@ from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy.test.testing import TestBase, eq_, AssertsExecutionResults, assert_raises -from sqlalchemy.test import testing +from test.lib.testing import TestBase, eq_, AssertsExecutionResults, assert_raises +from test.lib import testing from sqlalchemy.orm.attributes import instance_state from sqlalchemy.orm.exc import FlushError -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column engine = testing.db diff --git a/test/orm/test_manytomany.py b/test/orm/test_manytomany.py index d891e319e..0e7a6e40f 100644 --- a/test/orm/test_manytomany.py +++ b/test/orm/test_manytomany.py @@ -1,10 +1,10 @@ -from sqlalchemy.test.testing import assert_raises, \ +from test.lib.testing import assert_raises, \ assert_raises_message, eq_ import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, create_session, \ exc as orm_exc, sessionmaker from test.orm import _base diff --git a/test/orm/test_mapper.py b/test/orm/test_mapper.py index 78e0f2206..7ea4209a8 100644 --- a/test/orm/test_mapper.py +++ b/test/orm/test_mapper.py @@ -1,10 +1,10 @@ """General mapper operations with an emphasis on selecting/loading.""" -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import sqlalchemy as sa -from sqlalchemy.test import testing, pickleable +from test.lib import testing, pickleable from sqlalchemy import MetaData, Integer, String, ForeignKey, func, util -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.engine import default from sqlalchemy.orm import mapper, relationship, backref, \ create_session, class_mapper, configure_mappers, reconstructor, \ @@ -13,10 +13,10 @@ from sqlalchemy.orm import defer, deferred, synonym, attributes, \ column_property, composite, relationship, dynamic_loader, \ comparable_property, AttributeExtension from sqlalchemy.orm.instrumentation import ClassManager -from sqlalchemy.test.testing import eq_, AssertsCompiledSQL +from test.lib.testing import eq_, AssertsCompiledSQL from test.orm import _base, _fixtures -from sqlalchemy.test.assertsql import AllOf, CompiledSQL from sqlalchemy import event +from test.lib.assertsql import AllOf, CompiledSQL class MapperTest(_fixtures.FixtureTest): diff --git a/test/orm/test_merge.py b/test/orm/test_merge.py index 50d001a8c..fbdbcfe21 100644 --- a/test/orm/test_merge.py +++ b/test/orm/test_merge.py @@ -1,18 +1,18 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import sqlalchemy as sa from sqlalchemy import Integer, PickleType, String import operator -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy.util import OrderedSet from sqlalchemy.orm import mapper, relationship, create_session, \ PropComparator, synonym, comparable_property, sessionmaker, \ attributes, Session from sqlalchemy.orm.collections import attribute_mapped_collection from sqlalchemy.orm.interfaces import MapperOption -from sqlalchemy.test.testing import eq_, ne_ +from test.lib.testing import eq_, ne_ from test.orm import _base, _fixtures -from sqlalchemy.test.schema import Table, Column from sqlalchemy import event +from test.lib.schema import Table, Column class MergeTest(_fixtures.FixtureTest): """Session.merge() functionality""" diff --git a/test/orm/test_naturalpks.py b/test/orm/test_naturalpks.py index ca88251d7..f9ce7b3ca 100644 --- a/test/orm/test_naturalpks.py +++ b/test/orm/test_naturalpks.py @@ -2,15 +2,15 @@ Primary key changing capabilities and passive/non-passive cascading updates. """ -from sqlalchemy.test.testing import eq_, ne_, \ +from test.lib.testing import eq_, ne_, \ assert_raises, assert_raises_message import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, Unicode -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session, backref, Session from sqlalchemy.orm.session import make_transient -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base, _fixtures class NaturalPKTest(_base.MappedTest): @@ -862,7 +862,7 @@ class CascadeToFKPKTest(_base.MappedTest, testing.AssertsCompiledSQL): sess.add(u2) sess.add(a2) - from sqlalchemy.test.assertsql import CompiledSQL + from test.lib.assertsql import CompiledSQL # test that the primary key columns of addresses are not # being updated as well, since this is a row switch. diff --git a/test/orm/test_onetoone.py b/test/orm/test_onetoone.py index 4e3cade9b..7097a266e 100644 --- a/test/orm/test_onetoone.py +++ b/test/orm/test_onetoone.py @@ -1,7 +1,7 @@ import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session from test.orm import _base diff --git a/test/orm/test_pickled.py b/test/orm/test_pickled.py index f23bc92a1..a246ddbdc 100644 --- a/test/orm/test_pickled.py +++ b/test/orm/test_pickled.py @@ -1,10 +1,10 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import pickle import sqlalchemy as sa -from sqlalchemy.test import testing -from sqlalchemy.test.testing import assert_raises_message +from test.lib import testing +from test.lib.testing import assert_raises_message from sqlalchemy import Integer, String, ForeignKey, exc, MetaData -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session, \ sessionmaker, attributes, interfaces,\ clear_mappers, exc as orm_exc,\ diff --git a/test/orm/test_query.py b/test/orm/test_query.py index 18c95167f..db7e53a0e 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import operator from sqlalchemy import * from sqlalchemy import exc as sa_exc, util @@ -7,10 +7,10 @@ from sqlalchemy.engine import default from sqlalchemy.orm import * from sqlalchemy.orm import attributes -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import sqlalchemy as sa -from sqlalchemy.test import testing, AssertsCompiledSQL, Column, engines +from test.lib import testing, AssertsCompiledSQL, Column, engines from test.orm import _fixtures from test.orm._fixtures import keywords, addresses, Base, \ diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py index 2ad8bc8aa..423406837 100644 --- a/test/orm/test_relationships.py +++ b/test/orm/test_relationships.py @@ -1,14 +1,14 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import datetime import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import Integer, String, ForeignKey, MetaData, and_ -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, relation, \ backref, create_session, configure_mappers, \ clear_mappers, sessionmaker, attributes,\ Session, composite, column_property -from sqlalchemy.test.testing import eq_, startswith_ +from test.lib.testing import eq_, startswith_ from test.orm import _base, _fixtures diff --git a/test/orm/test_scoping.py b/test/orm/test_scoping.py index fa1777c85..43472eae3 100644 --- a/test/orm/test_scoping.py +++ b/test/orm/test_scoping.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy.orm import scoped_session from sqlalchemy import Integer, String, ForeignKey -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, query -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base diff --git a/test/orm/test_selectable.py b/test/orm/test_selectable.py index e46d8bbc8..30278b5bc 100644 --- a/test/orm/test_selectable.py +++ b/test/orm/test_selectable.py @@ -1,11 +1,11 @@ """Generic mapping to Select statements""" -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message import sqlalchemy as sa -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy import String, Integer, select -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, create_session -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.orm import _base diff --git a/test/orm/test_session.py b/test/orm/test_session.py index 62047970c..0486a8124 100644 --- a/test/orm/test_session.py +++ b/test/orm/test_session.py @@ -1,18 +1,18 @@ -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message -from sqlalchemy.test.util import gc_collect +from test.lib.util import gc_collect import inspect import pickle from sqlalchemy.orm import create_session, sessionmaker, attributes, \ make_transient, Session from sqlalchemy.orm.attributes import instance_state import sqlalchemy as sa -from sqlalchemy.test import engines, testing, config +from test.lib import engines, testing, config from sqlalchemy import Integer, String, Sequence -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, backref, joinedload, \ exc as orm_exc, object_session -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from test.engine import _base as engine_base from test.orm import _base, _fixtures from sqlalchemy import event diff --git a/test/orm/test_subquery_relations.py b/test/orm/test_subquery_relations.py index 5eba68e13..2aadf26d4 100644 --- a/test/orm/test_subquery_relations.py +++ b/test/orm/test_subquery_relations.py @@ -1,13 +1,13 @@ -from sqlalchemy.test.testing import eq_, is_, is_not_ -from sqlalchemy.test import testing -from sqlalchemy.test.schema import Table, Column +from test.lib.testing import eq_, is_, is_not_ +from test.lib import testing +from test.lib.schema import Table, Column from sqlalchemy import Integer, String, ForeignKey, bindparam from sqlalchemy.orm import backref, subqueryload, subqueryload_all, \ mapper, relationship, clear_mappers, create_session, lazyload, \ aliased, joinedload, deferred, undefer, eagerload_all -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message -from sqlalchemy.test.assertsql import CompiledSQL +from test.lib.assertsql import CompiledSQL from test.orm import _base, _fixtures import sqlalchemy as sa diff --git a/test/orm/test_transaction.py b/test/orm/test_transaction.py index 2617f12f0..7f0ada49f 100644 --- a/test/orm/test_transaction.py +++ b/test/orm/test_transaction.py @@ -1,12 +1,12 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy.orm import attributes from sqlalchemy import exc as sa_exc from sqlalchemy.orm import exc as orm_exc from sqlalchemy.orm import * -from sqlalchemy.test.util import gc_collect -from sqlalchemy.test import testing +from test.lib.util import gc_collect +from test.lib import testing from test.orm import _base from test.orm._fixtures import FixtureTest, User, Address, users, addresses diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py index 511adde82..6b6251d66 100644 --- a/test/orm/test_unitofwork.py +++ b/test/orm/test_unitofwork.py @@ -1,23 +1,23 @@ # coding: utf-8 """Tests unitofwork operations.""" -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import datetime import operator from sqlalchemy.orm import mapper as orm_mapper import sqlalchemy as sa -from sqlalchemy.test import engines, testing, pickleable from sqlalchemy import Integer, String, ForeignKey, literal_column, event -from sqlalchemy.test.schema import Table -from sqlalchemy.test.schema import Column +from test.lib import engines, testing, pickleable +from test.lib.schema import Table +from test.lib.schema import Column from sqlalchemy.orm import mapper, relationship, create_session, \ column_property, attributes, Session, reconstructor, object_session -from sqlalchemy.test.testing import eq_, ne_ -from sqlalchemy.test.util import gc_collect +from test.lib.testing import eq_, ne_ +from test.lib.util import gc_collect from test.orm import _base, _fixtures from test.engine import _base as engine_base -from sqlalchemy.test.assertsql import AllOf, CompiledSQL +from test.lib.assertsql import AllOf, CompiledSQL import gc class UnitOfWorkTest(object): diff --git a/test/orm/test_unitofworkv2.py b/test/orm/test_unitofworkv2.py index d91799305..73a884e0c 100644 --- a/test/orm/test_unitofworkv2.py +++ b/test/orm/test_unitofworkv2.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message -from sqlalchemy.test import testing -from sqlalchemy.test.schema import Table, Column +from test.lib.testing import eq_, assert_raises, assert_raises_message +from test.lib import testing +from test.lib.schema import Table, Column from sqlalchemy import Integer, String, ForeignKey, func from test.orm import _fixtures, _base from sqlalchemy.orm import mapper, relationship, backref, \ create_session, unitofwork, attributes -from sqlalchemy.test.assertsql import AllOf, CompiledSQL +from test.lib.assertsql import AllOf, CompiledSQL from test.orm._fixtures import keywords, addresses, Base, Keyword, \ Dingaling, item_keywords, dingalings, User, items,\ diff --git a/test/orm/test_utils.py b/test/orm/test_utils.py index 43a15056c..1ee34c50f 100644 --- a/test/orm/test_utils.py +++ b/test/orm/test_utils.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy.orm import interfaces, util from sqlalchemy import Column from sqlalchemy import Integer @@ -8,10 +8,10 @@ from sqlalchemy.orm import aliased from sqlalchemy.orm import mapper, create_session -from sqlalchemy.test import TestBase, testing +from test.lib import TestBase, testing from test.orm import _fixtures -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ class AliasedClassTest(TestBase): diff --git a/test/orm/test_versioning.py b/test/orm/test_versioning.py index 6cb2bb9e2..75f7fbb6e 100644 --- a/test/orm/test_versioning.py +++ b/test/orm/test_versioning.py @@ -1,9 +1,9 @@ import sqlalchemy as sa -from sqlalchemy.test import engines, testing +from test.lib import engines, testing from sqlalchemy import Integer, String, ForeignKey, literal_column, orm, exc -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column from sqlalchemy.orm import mapper, relationship, create_session, column_property, sessionmaker -from sqlalchemy.test.testing import eq_, ne_, assert_raises, assert_raises_message +from test.lib.testing import eq_, ne_, assert_raises, assert_raises_message from test.orm import _base, _fixtures from test.engine import _base as engine_base diff --git a/test/perf/insertspeed.py b/test/perf/insertspeed.py index 0491e9f95..3ae1ccbde 100644 --- a/test/perf/insertspeed.py +++ b/test/perf/insertspeed.py @@ -2,7 +2,7 @@ import testenv; testenv.simple_setup() import sys, time from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import profiling +from test.lib import profiling db = create_engine('sqlite://') metadata = MetaData(db) diff --git a/test/perf/large_flush.py b/test/perf/large_flush.py index 431a28944..b23de080c 100644 --- a/test/perf/large_flush.py +++ b/test/perf/large_flush.py @@ -3,7 +3,7 @@ from sqlalchemy import create_engine, MetaData, orm from sqlalchemy import Column, ForeignKey from sqlalchemy import Integer, String from sqlalchemy.orm import mapper -from sqlalchemy.test import profiling +from test.lib import profiling class Object(object): pass diff --git a/test/perf/masscreate2.py b/test/perf/masscreate2.py index e525fcf99..6ad2194cd 100644 --- a/test/perf/masscreate2.py +++ b/test/perf/masscreate2.py @@ -3,7 +3,7 @@ import testenv; testenv.simple_setup() import random, string from sqlalchemy.orm import attributes -from sqlalchemy.test.util import gc_collect +from test.lib.util import gc_collect # with this test, run top. make sure the Python process doenst grow in size arbitrarily. diff --git a/test/perf/masseagerload.py b/test/perf/masseagerload.py index 2ed8d2803..6e6d86d54 100644 --- a/test/perf/masseagerload.py +++ b/test/perf/masseagerload.py @@ -1,6 +1,6 @@ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import profiling +from test.lib import profiling NUM = 500 DIVISOR = 50 diff --git a/test/perf/massload.py b/test/perf/massload.py index f6cde3adf..06cfae786 100644 --- a/test/perf/massload.py +++ b/test/perf/massload.py @@ -2,7 +2,7 @@ import time #import sqlalchemy.orm.attributes as attributes from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import * +from test.lib import * """ diff --git a/test/perf/masssave.py b/test/perf/masssave.py index 41acd12cc..3c1547d38 100644 --- a/test/perf/masssave.py +++ b/test/perf/masssave.py @@ -2,7 +2,7 @@ import gc import types from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import * +from test.lib import * NUM = 2500 diff --git a/test/perf/objselectspeed.py b/test/perf/objselectspeed.py index 816643680..126c9c707 100644 --- a/test/perf/objselectspeed.py +++ b/test/perf/objselectspeed.py @@ -1,8 +1,8 @@ import time, resource from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test.util import gc_collect -from sqlalchemy.test import profiling +from test.lib.util import gc_collect +from test.lib import profiling db = create_engine('sqlite://') metadata = MetaData(db) diff --git a/test/perf/objupdatespeed.py b/test/perf/objupdatespeed.py index fad22189a..078d95fa3 100644 --- a/test/perf/objupdatespeed.py +++ b/test/perf/objupdatespeed.py @@ -1,8 +1,8 @@ import time, resource from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import * -from sqlalchemy.test.util import gc_collect +from test.lib import * +from test.lib.util import gc_collect NUM = 100 diff --git a/test/perf/ormsession.py b/test/perf/ormsession.py index 0b01fc5a3..aff265ff1 100644 --- a/test/perf/ormsession.py +++ b/test/perf/ormsession.py @@ -3,8 +3,8 @@ from datetime import datetime from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import * -from sqlalchemy.test.profiling import profiled +from test.lib import * +from test.lib.profiling import profiled class Item(object): def __repr__(self): diff --git a/test/perf/poolload.py b/test/perf/poolload.py index 62c66fbae..345720f0c 100644 --- a/test/perf/poolload.py +++ b/test/perf/poolload.py @@ -2,7 +2,7 @@ import thread, time from sqlalchemy import * import sqlalchemy.pool as pool -from sqlalchemy.test import testing +from test.lib import testing db = create_engine(testing.db.url, pool_timeout=30, echo_pool=True) metadata = MetaData(db) diff --git a/test/perf/sessions.py b/test/perf/sessions.py index 4210732d6..2fe4f758f 100644 --- a/test/perf/sessions.py +++ b/test/perf/sessions.py @@ -1,8 +1,8 @@ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test.compat import gc_collect -from sqlalchemy.test import TestBase, AssertsExecutionResults, profiling, testing +from test.lib.compat import gc_collect +from test.lib import TestBase, AssertsExecutionResults, profiling, testing from test.orm import _fixtures # in this test we are specifically looking for time spent in the attributes.InstanceState.__cleanup() method. diff --git a/test/perf/wsgi.py b/test/perf/wsgi.py index 549c92ade..27aa4a8c8 100644 --- a/test/perf/wsgi.py +++ b/test/perf/wsgi.py @@ -4,7 +4,7 @@ from sqlalchemy import * from sqlalchemy.orm import * import thread -from sqlalchemy.test import * +from test.lib import * port = 8000 diff --git a/test/sql/test_case_statement.py b/test/sql/test_case_statement.py index 1a106ee5e..7bc3ab31f 100644 --- a/test/sql/test_case_statement.py +++ b/test/sql/test_case_statement.py @@ -1,7 +1,7 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message, eq_ +from test.lib.testing import assert_raises, assert_raises_message, eq_ import sys from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * from sqlalchemy import util, exc from sqlalchemy.sql import table, column diff --git a/test/sql/test_columns.py b/test/sql/test_columns.py index 3cbb01943..95933b41b 100644 --- a/test/sql/test_columns.py +++ b/test/sql/test_columns.py @@ -1,7 +1,7 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy import exc, sql -from sqlalchemy.test import * +from test.lib import * from sqlalchemy import Table, Column # don't use testlib's wrappers diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index f6cffc116..01fe648a4 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -1,4 +1,4 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import datetime, re, operator from sqlalchemy import * from sqlalchemy import exc, sql, util @@ -6,7 +6,7 @@ from sqlalchemy.sql import table, column, label, compiler from sqlalchemy.sql.expression import ClauseList from sqlalchemy.engine import default from sqlalchemy.databases import * -from sqlalchemy.test import * +from test.lib import * table1 = table('mytable', column('myid', Integer), diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index 69f29a9bd..56c5c6205 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy import exc, schema -from sqlalchemy.test import * -from sqlalchemy.test import config, engines +from test.lib import * +from test.lib import config, engines from sqlalchemy.engine import ddl -from sqlalchemy.test.testing import eq_ -from sqlalchemy.test.assertsql import AllOf, RegexSQL, ExactSQL, CompiledSQL +from test.lib.testing import eq_ +from test.lib.assertsql import AllOf, RegexSQL, ExactSQL, CompiledSQL from sqlalchemy.dialects.postgresql import base as postgresql class ConstraintTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py index f49e4d0d3..7ec43f8d2 100644 --- a/test/sql/test_defaults.py +++ b/test/sql/test_defaults.py @@ -1,13 +1,13 @@ -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import datetime from sqlalchemy import Sequence, Column, func from sqlalchemy.schema import CreateSequence, DropSequence from sqlalchemy.sql import select, text import sqlalchemy as sa -from sqlalchemy.test import testing, engines +from test.lib import testing, engines from sqlalchemy import MetaData, Integer, String, ForeignKey, Boolean, exc -from sqlalchemy.test.schema import Table -from sqlalchemy.test.testing import eq_ +from test.lib.schema import Table +from test.lib.testing import eq_ from test.sql import _base diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index c9bb8348c..396eaaf9b 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -1,17 +1,17 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import datetime from sqlalchemy import * from sqlalchemy.sql import table, column from sqlalchemy import databases, sql, util from sqlalchemy.sql.compiler import BIND_TEMPLATES from sqlalchemy.engine import default -from sqlalchemy.test.engines import all_dialects +from test.lib.engines import all_dialects from sqlalchemy import types as sqltypes -from sqlalchemy.test import * +from test.lib import * from sqlalchemy.sql.functions import GenericFunction -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from decimal import Decimal as _python_Decimal -from sqlalchemy.test import testing +from test.lib import testing from sqlalchemy.databases import * diff --git a/test/sql/test_generative.py b/test/sql/test_generative.py index 26f9c1ad0..e129f69c4 100644 --- a/test/sql/test_generative.py +++ b/test/sql/test_generative.py @@ -1,11 +1,11 @@ from sqlalchemy import * from sqlalchemy.sql import table, column, ClauseElement from sqlalchemy.sql.expression import _clone, _from_objects -from sqlalchemy.test import * +from test.lib import * from sqlalchemy.sql.visitors import * from sqlalchemy import util from sqlalchemy.sql import util as sql_util -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ class TraversalTest(TestBase, AssertsExecutionResults): """test ClauseVisitor's traversal, particularly its ability to copy and modify diff --git a/test/sql/test_labels.py b/test/sql/test_labels.py index f67ba9855..0f84c30a0 100644 --- a/test/sql/test_labels.py +++ b/test/sql/test_labels.py @@ -1,7 +1,7 @@ -from sqlalchemy.test.testing import assert_raises, assert_raises_message +from test.lib.testing import assert_raises, assert_raises_message from sqlalchemy import * from sqlalchemy import exc as exceptions -from sqlalchemy.test import * +from test.lib import * from sqlalchemy.engine import default IDENT_LENGTH = 29 diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 410ff73a6..f59b34076 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -1,11 +1,11 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import datetime from sqlalchemy import * from sqlalchemy import exc, sql, util from sqlalchemy.engine import default, base -from sqlalchemy.test import * -from sqlalchemy.test.testing import eq_, assert_raises_message, assert_raises -from sqlalchemy.test.schema import Table, Column +from test.lib import * +from test.lib.testing import eq_, assert_raises_message, assert_raises +from test.lib.schema import Table, Column class QueryTest(TestBase): diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py index 81a68ec74..8f27a7b3c 100644 --- a/test/sql/test_quote.py +++ b/test/sql/test_quote.py @@ -1,7 +1,7 @@ from sqlalchemy import * from sqlalchemy import sql, schema from sqlalchemy.sql import compiler -from sqlalchemy.test import * +from test.lib import * class QuoteTest(TestBase, AssertsCompiledSQL): @classmethod diff --git a/test/sql/test_returning.py b/test/sql/test_returning.py index 332f4eef5..632a739f1 100644 --- a/test/sql/test_returning.py +++ b/test/sql/test_returning.py @@ -1,7 +1,7 @@ -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ from sqlalchemy import * -from sqlalchemy.test import * -from sqlalchemy.test.schema import Table, Column +from test.lib import * +from test.lib.schema import Table, Column from sqlalchemy.types import TypeDecorator class ReturningTest(TestBase, AssertsExecutionResults): diff --git a/test/sql/test_rowcount.py b/test/sql/test_rowcount.py index ccd0d8f5e..ed40f2801 100644 --- a/test/sql/test_rowcount.py +++ b/test/sql/test_rowcount.py @@ -1,5 +1,5 @@ from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * class FoundRowsTest(TestBase, AssertsExecutionResults): diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 5bebbe05f..77acf896b 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -1,9 +1,9 @@ """Test various algorithmic properties of selectables.""" -from sqlalchemy.test.testing import eq_, assert_raises, \ +from test.lib.testing import eq_, assert_raises, \ assert_raises_message from sqlalchemy import * -from sqlalchemy.test import * +from test.lib import * from sqlalchemy.sql import util as sql_util, visitors from sqlalchemy import exc from sqlalchemy.sql import table, column, null diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 993843891..bfadca7c9 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -1,18 +1,18 @@ # coding: utf-8 -from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message +from test.lib.testing import eq_, assert_raises, assert_raises_message import decimal import datetime, os, re from sqlalchemy import * from sqlalchemy import exc, types, util, schema from sqlalchemy.sql import operators, column, table -from sqlalchemy.test.testing import eq_ +from test.lib.testing import eq_ import sqlalchemy.engine.url as url from sqlalchemy.databases import * -from sqlalchemy.test.schema import Table, Column -from sqlalchemy.test import * -from sqlalchemy.test.util import picklers +from test.lib.schema import Table, Column +from test.lib import * +from test.lib.util import picklers from decimal import Decimal -from sqlalchemy.test.util import round_decimal +from test.lib.util import round_decimal class AdaptTest(TestBase): diff --git a/test/sql/test_unicode.py b/test/sql/test_unicode.py index a116d34cb..2eda4ffa8 100644 --- a/test/sql/test_unicode.py +++ b/test/sql/test_unicode.py @@ -2,8 +2,8 @@ """verrrrry basic unicode column name testing""" from sqlalchemy import * -from sqlalchemy.test import * -from sqlalchemy.test.engines import utf8_engine +from test.lib import * +from test.lib.engines import utf8_engine from sqlalchemy.sql import column class UnicodeSchemaTest(TestBase): diff --git a/test/zblog/tables.py b/test/zblog/tables.py index 4907259e1..3326c28fb 100644 --- a/test/zblog/tables.py +++ b/test/zblog/tables.py @@ -1,7 +1,7 @@ """application table metadata objects are described here.""" from sqlalchemy import * -from sqlalchemy.test.schema import Table, Column +from test.lib.schema import Table, Column metadata = MetaData() diff --git a/test/zblog/test_zblog.py b/test/zblog/test_zblog.py index 8103cde8b..ec6402a6e 100644 --- a/test/zblog/test_zblog.py +++ b/test/zblog/test_zblog.py @@ -1,6 +1,6 @@ from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy.test import * +from test.lib import * from test.zblog import mappers, tables from test.zblog.user import * from test.zblog.blog import * |