]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- updated the naming scheme of the base test classes in test/testlib/testing.py;
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 11 Feb 2008 00:28:39 +0000 (00:28 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 11 Feb 2008 00:28:39 +0000 (00:28 +0000)
tests extend from either TestBase or ORMTest, using additional mixins for
special assertion methods as needed

67 files changed:
test/base/dependency.py
test/base/utils.py
test/dialect/access.py
test/dialect/firebird.py
test/dialect/informix.py
test/dialect/maxdb.py
test/dialect/mssql.py
test/dialect/mysql.py
test/dialect/oracle.py
test/dialect/postgres.py
test/dialect/sqlite.py
test/dialect/sybase.py
test/engine/bind.py
test/engine/ddlevents.py
test/engine/execute.py
test/engine/metadata.py
test/engine/parseconnect.py
test/engine/pool.py
test/engine/reconnect.py
test/engine/reflection.py
test/engine/transaction.py
test/ext/activemapper.py
test/ext/assignmapper.py
test/ext/associationproxy.py
test/ext/orderinglist.py
test/orm/association.py
test/orm/assorted_eager.py
test/orm/attributes.py
test/orm/cascade.py
test/orm/collection.py
test/orm/compile.py
test/orm/cycles.py
test/orm/entity.py
test/orm/generative.py
test/orm/inheritance/polymorph2.py
test/orm/inheritance/single.py
test/orm/lazytest1.py
test/orm/mapper.py
test/orm/memusage.py
test/orm/merge.py
test/orm/onetoone.py
test/orm/relationships.py
test/orm/session.py
test/orm/sessioncontext.py
test/orm/sharding/shard.py
test/perf/massload.py
test/perf/masssave.py
test/perf/sessions.py
test/profiling/compiler.py
test/profiling/pool.py
test/profiling/zoomark.py
test/sql/case_statement.py
test/sql/constraints.py
test/sql/defaults.py
test/sql/functions.py
test/sql/generative.py
test/sql/labels.py
test/sql/query.py
test/sql/quote.py
test/sql/rowcount.py
test/sql/select.py
test/sql/selectable.py
test/sql/testtypes.py
test/sql/unicode.py
test/testlib/__init__.py
test/testlib/testing.py
test/zblog/tests.py

index 56767dc84008262ac5c1a5131f96713f2da76f42..25d34ffd39a018a8e218fe6fe683e6e74856a37f 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import util
 from testlib import *
 
 
-class DependencySortTest(PersistTest):
+class DependencySortTest(TestBase):
     def assert_sort(self, tuples, node, collection=None):
         print str(node)
         def assert_tuple(tuple, node):
index 9d65263793fa820cf1ea657cc82ba911d7d4f63e..6ab141d6cbd74dc6be64d362531dd4ca5b95d53f 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import util, sql, exceptions
 from testlib import *
 from testlib import sorted
 
-class OrderedDictTest(PersistTest):
+class OrderedDictTest(TestBase):
     def test_odict(self):
         o = util.OrderedDict()
         o['a'] = 1
@@ -35,7 +35,7 @@ class OrderedDictTest(PersistTest):
         self.assert_(o.keys() == ['a', 'b', 'c', 'd', 'e', 'f'])
         self.assert_(o.values() == [1, 2, 3, 4, 5, 6])
 
-class OrderedSetTest(PersistTest):
+class OrderedSetTest(TestBase):
     def test_mutators_against_iter(self):
         # testing a set modified against an iterator
         o = util.OrderedSet([3,2, 4, 5])
@@ -47,7 +47,7 @@ class OrderedSetTest(PersistTest):
         self.assertEquals(o.union(iter([3,4, 6])),
                           util.OrderedSet([2, 3, 4, 5, 6]))
 
-class ColumnCollectionTest(PersistTest):
+class ColumnCollectionTest(TestBase):
     def test_in(self):
         cc = sql.ColumnCollection()
         cc.add(sql.column('col1'))
@@ -322,7 +322,7 @@ class DictlikeIteritemsTest(unittest.TestCase):
         self._notok(duck6())
 
 
-class ArgInspectionTest(PersistTest):
+class ArgInspectionTest(TestBase):
     def test_get_cls_kwargs(self):
         class A(object):
             def __init__(self, a):
index 52a72e66a5cf40d9914cf3e9dc3518a37a7a2907..311231947e567b005dabfb9dd75eacd63c9eab7e 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy.databases import access
 from testlib import *
 
 
-class BasicTest(AssertMixin):
+class BasicTest(TestBase, AssertsExecutionResults):
     # A simple import of the database/ module should work on all systems.
     def test_import(self):
         # we got this far, right?
index e327bf151fb3b17b456318c3894f53ba2413c54b..fe4161a1bdfa450f4464499353f5eaa3f7c87900 100644 (file)
@@ -6,7 +6,7 @@ from sqlalchemy.sql import table, column
 from testlib import *
 
 
-class DomainReflectionTest(AssertMixin):
+class DomainReflectionTest(TestBase, AssertsExecutionResults):
     "Test Firebird domains"
 
     __only_on__ = 'firebird'
@@ -68,7 +68,7 @@ class DomainReflectionTest(AssertMixin):
         self.assertEquals(table.c.dt.type.__class__, firebird.FBDateTime)
 
 
-class CompileTest(SQLCompileTest):
+class CompileTest(TestBase, AssertsCompiledSQL):
     __dialect__ = firebird.FBDialect()
 
     def test_alias(self):
@@ -86,7 +86,7 @@ class CompileTest(SQLCompileTest):
         self.assert_compile(select([func.max(t.c.col1)]), "SELECT max(sometable.col1) AS max_1 FROM sometable")
 
 
-class MiscFBTests(PersistTest):
+class MiscFBTests(TestBase):
 
     __only_on__ = 'firebird'
 
index da518075b2caabb25c2a36021008aaf108d1b0d1..4a2546f174f91c4c7bdfa8479c53ed96971f6ab8 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy.databases import informix
 from testlib import *
 
 
-class BasicTest(AssertMixin):
+class BasicTest(TestBase, AssertsExecutionResults):
     # A simple import of the database/ module should work on all systems.
     def test_import(self):
         # we got this far, right?
index 4ec9faa6cafe926d5173bce5aeaa27a9215c81ba..0a35f54705ee9746be7fb4d80cac26ce8ff7cb9a 100644 (file)
@@ -15,7 +15,7 @@ from testlib import *
 # - datetime tests
 # - the orm/query 'test_has' destabilizes the server- cover here
 
-class ReflectionTest(AssertMixin):
+class ReflectionTest(TestBase, AssertsExecutionResults):
     """Extra reflection tests."""
 
     __only_on__ = 'maxdb'
@@ -168,7 +168,7 @@ class ReflectionTest(AssertMixin):
             except exceptions.DatabaseError:
                 pass
 
-class DBAPITest(AssertMixin):
+class DBAPITest(TestBase, AssertsExecutionResults):
     """Asserts quirks in the native Python DB-API driver.
 
     If any of these fail, that's good- the bug is fixed!
index 5a7707052cb46497b0f80fd3a57d48635b8c7a71..c5ba6271808a598e7bb0cc5c7ff078ae1b79359f 100755 (executable)
@@ -8,7 +8,7 @@ from sqlalchemy.databases import mssql
 from testlib import *
 
 
-class CompileTest(SQLCompileTest):
+class CompileTest(TestBase, AssertsCompiledSQL):
     __dialect__ = mssql.MSSQLDialect()
 
     def test_insert(self):
@@ -94,7 +94,7 @@ class CompileTest(SQLCompileTest):
         t = Table('sometable', m, Column('col1', Integer), Column('col2', Integer))
         self.assert_compile(select([func.max(t.c.col1)]), "SELECT max(sometable.col1) AS max_1 FROM sometable")
 
-class ReflectionTest(PersistTest):
+class ReflectionTest(TestBase):
     __only_on__ = 'mssql'
 
     def testidentity(self):
@@ -114,7 +114,7 @@ class ReflectionTest(PersistTest):
             table.drop()
 
 
-class QueryTest(PersistTest):
+class QueryTest(TestBase):
     __only_on__ = 'mssql'
 
     def test_fetchid_trigger(self):
@@ -209,7 +209,7 @@ class Foo(object):
         for k in kw:
             setattr(self, k, kw[k])
 
-class GenerativeQueryTest(PersistTest):
+class GenerativeQueryTest(TestBase):
     __only_on__ = 'mssql'
 
     def setUpAll(self):
index 2b589f62545b5eef317fd66d916bc4b88d14e5fc..e1bd47d29113e0eac1ceba19de0d3fa572627ef7 100644 (file)
@@ -6,7 +6,7 @@ from sqlalchemy.databases import mysql
 from testlib import *
 
 
-class TypesTest(AssertMixin):
+class TypesTest(TestBase, AssertsExecutionResults):
     "Test MySQL column types"
 
     __only_on__ = 'mysql'
@@ -762,7 +762,7 @@ class TypesTest(AssertMixin):
         self.assertEqual(got, wanted)
 
 
-class SQLTest(SQLCompileTest):
+class SQLTest(TestBase, AssertsCompiledSQL):
     """Tests MySQL-dialect specific compilation."""
 
     __dialect__ = mysql.dialect()
index 9436d1915a6ad630e425ffaf5c7d311e75de8cd3..cb4ead18ce0115afab62ad92a40fc420c3e6cbb3 100644 (file)
@@ -5,7 +5,7 @@ from sqlalchemy.databases import oracle
 from testlib import *
 
 
-class OutParamTest(AssertMixin):
+class OutParamTest(TestBase, AssertsExecutionResults):
     __only_on__ = 'oracle'
 
     def setUpAll(self):
@@ -28,7 +28,7 @@ create or replace procedure foo(x_in IN number, x_out OUT number, y_out OUT numb
          testing.db.execute("DROP PROCEDURE foo")
 
 
-class CompileTest(SQLCompileTest):
+class CompileTest(TestBase, AssertsCompiledSQL):
     __dialect__ = oracle.OracleDialect()
 
     def test_subquery(self):
@@ -135,7 +135,7 @@ myothertable.othername != :myothertable_othername_1 OR EXISTS (select yay from f
             "ON addresses.address_type_id = address_types_1.id WHERE addresses.user_id = :addresses_user_id_1 ORDER BY addresses.rowid, "
             "address_types.rowid")
 
-class TypesTest(SQLCompileTest):
+class TypesTest(TestBase, AssertsCompiledSQL):
     __only_on__ = 'oracle'
 
     def test_no_clobs_for_string_params(self):
@@ -181,7 +181,7 @@ class TypesTest(SQLCompileTest):
         finally:
             testing.db.execute("DROP TABLE Z_TEST")
 
-class SequenceTest(SQLCompileTest):
+class SequenceTest(TestBase, AssertsCompiledSQL):
     def test_basic(self):
         seq = Sequence("my_seq_no_schema")
         dialect = oracle.OracleDialect()
index 760affe8f9337cc5bd83c9dd8ec1044c7092da62..9ec44203a4b851a881c43df67663aff7e42e70ac 100644 (file)
@@ -8,7 +8,7 @@ from testlib import *
 from sqlalchemy.sql import table, column
 
 
-class SequenceTest(SQLCompileTest):
+class SequenceTest(TestBase, AssertsCompiledSQL):
     def test_basic(self):
         seq = Sequence("my_seq_no_schema")
         dialect = postgres.PGDialect()
@@ -20,7 +20,7 @@ class SequenceTest(SQLCompileTest):
         seq = Sequence("My_Seq", schema="Some_Schema")
         assert dialect.identifier_preparer.format_sequence(seq) == '"Some_Schema"."My_Seq"'
 
-class CompileTest(SQLCompileTest):
+class CompileTest(TestBase, AssertsCompiledSQL):
     def test_update_returning(self):
         dialect = postgres.dialect()
         table1 = table('mytable',
@@ -57,7 +57,7 @@ class CompileTest(SQLCompileTest):
         i = insert(table1, values=dict(name='foo'), postgres_returning=[func.length(table1.c.name)])
         self.assert_compile(i, "INSERT INTO mytable (name) VALUES (%(name)s) RETURNING length(mytable.name)", dialect=dialect)
 
-class ReturningTest(AssertMixin):
+class ReturningTest(TestBase, AssertsExecutionResults):
     __only_on__ = 'postgres'
 
     @testing.exclude('postgres', '<', (8, 2))
@@ -109,7 +109,7 @@ class ReturningTest(AssertMixin):
             table.drop()
 
 
-class InsertTest(AssertMixin):
+class InsertTest(TestBase, AssertsExecutionResults):
     __only_on__ = 'postgres'
 
     def setUpAll(self):
@@ -376,7 +376,7 @@ class InsertTest(AssertMixin):
             (33, 'd4'),
         ]
 
-class DomainReflectionTest(AssertMixin):
+class DomainReflectionTest(TestBase, AssertsExecutionResults):
     "Test PostgreSQL domains"
 
     __only_on__ = 'postgres'
@@ -431,7 +431,7 @@ class DomainReflectionTest(AssertMixin):
         self.assertEquals(str(table.columns.answer.default.arg), '0', "Reflected default value didn't equal expected value")
         self.assertTrue(table.columns.answer.nullable, "Expected reflected column to be nullable.")
 
-class MiscTest(AssertMixin):
+class MiscTest(TestBase, AssertsExecutionResults):
     __only_on__ = 'postgres'
 
     def test_date_reflection(self):
@@ -605,7 +605,7 @@ class MiscTest(AssertMixin):
 
         assert executed_sql == ['CREATE INDEX test_idx1 ON testtbl (data) WHERE testtbl.data > 5 AND testtbl.data < 10']
 
-class TimezoneTest(AssertMixin):
+class TimezoneTest(TestBase, AssertsExecutionResults):
     """Test timezone-aware datetimes.
 
     psycopg will return a datetime with a tzinfo attached to it, if postgres
@@ -649,7 +649,7 @@ class TimezoneTest(AssertMixin):
         c = notztable.update(notztable.c.id==1).execute(name='newname')
         print notztable.select(tztable.c.id==1).execute().fetchone()
 
-class ArrayTest(AssertMixin):
+class ArrayTest(TestBase, AssertsExecutionResults):
     __only_on__ = 'postgres'
 
     def setUpAll(self):
index 70658330f88d79f320ff3e29fe010f554239d339..585a853d2a4fa5376be1e1d9fd1c3c6b12fb2389 100644 (file)
@@ -8,7 +8,7 @@ from sqlalchemy.databases import sqlite
 from testlib import *
 
 
-class TestTypes(AssertMixin):
+class TestTypes(TestBase, AssertsExecutionResults):
     __only_on__ = 'sqlite'
 
     def test_date(self):
@@ -100,7 +100,7 @@ class TestTypes(AssertMixin):
         finally:
             m.drop_all()
 
-class DialectTest(AssertMixin):
+class DialectTest(TestBase, AssertsExecutionResults):
     __only_on__ = 'sqlite'
 
     def test_extra_reserved_words(self):
@@ -216,7 +216,7 @@ class DialectTest(AssertMixin):
                 pass
             raise
 
-class InsertTest(AssertMixin):
+class InsertTest(TestBase, AssertsExecutionResults):
     """Tests inserts and autoincrement."""
 
     __only_on__ = 'sqlite'
index cdc8066b42463eec38fb74500588b26bd55a449b..19cca465bd0cf47bc1dc4960f41f82c65c727fbc 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy.databases import sybase
 from testlib import *
 
 
-class BasicTest(AssertMixin):
+class BasicTest(TestBase, AssertsExecutionResults):
     # A simple import of the database/ module should work on all systems.
     def test_import(self):
         # we got this far, right?
index c273bdb05e940243b4ebfab1cc6c6a05f26c5b46..db4955375db56831bea94273db80dedd07f39e28 100644 (file)
@@ -7,7 +7,7 @@ from sqlalchemy import engine, exceptions
 from testlib import *
 
 
-class BindTest(PersistTest):
+class BindTest(TestBase):
     def test_create_drop_explicit(self):
         metadata = MetaData()
         table = Table('test_table', metadata,
index e902ec709fb5b147eba014deddffa8a038a04b92..3a1f342b47418eaba756172cd3546141ae412d5c 100644 (file)
@@ -5,7 +5,7 @@ import sqlalchemy
 from testlib import *
 
 
-class DDLEventTest(PersistTest):
+class DDLEventTest(TestBase):
     class Canary(object):
         def __init__(self, schema_item, bind):
             self.state = None
@@ -189,7 +189,7 @@ class DDLEventTest(PersistTest):
         self.assertRaises(LookupError, metadata.append_ddl_listener, 'blah', fn)
 
 
-class DDLExecutionTest(PersistTest):
+class DDLExecutionTest(TestBase):
     def mock_engine(self):
         buffer = []
         def executor(sql, *a, **kw):
@@ -288,7 +288,7 @@ class DDLExecutionTest(PersistTest):
             r = eval(py)
             assert list(r) == [(1,)], py
 
-class DDLTest(PersistTest):
+class DDLTest(TestBase):
     def mock_engine(self):
         executor = lambda *a, **kw: None
         engine = create_engine(testing.db.name + '://',
index 220239fbefeec8b58c2b313e8d0b0f1097f05da6..643a22a185a8489478ebaae158a233c5c18ecdb4 100644 (file)
@@ -3,7 +3,7 @@ from sqlalchemy import *
 from sqlalchemy import exceptions
 from testlib import *
 
-class ExecuteTest(PersistTest):
+class ExecuteTest(TestBase):
     def setUpAll(self):
         global users, metadata
         metadata = MetaData(testing.db)
index dd4ee51d30609e18194dca8f691da8d761f31265..e93eb69a56d371ad46c6180e795c91c689b73b28 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import exceptions
 from testlib import *
 import pickle
 
-class MetaDataTest(PersistTest, ComparesTables):
+class MetaDataTest(TestBase, ComparesTables):
     def test_metadata_connect(self):
         metadata = MetaData()
         t1 = Table('table1', metadata, Column('col1', Integer, primary_key=True),
index df7ab711b3d9c0123d551e31ce1a0e9e217a824a..117c3ed4bb3ebc71d7933bf97b1016884cdbd3e1 100644 (file)
@@ -6,7 +6,7 @@ import sqlalchemy.engine.url as url
 from testlib import *
 
 
-class ParseConnectTest(PersistTest):
+class ParseConnectTest(TestBase):
     def test_rfc1738(self):
         for text in (
             'dbtype://username:password@hostspec:110//usr/db_file.db',
@@ -37,7 +37,7 @@ class ParseConnectTest(PersistTest):
             assert u.host == 'hostspec' or u.host == '127.0.0.1' or (not u.host)
             assert str(u) == text
 
-class CreateEngineTest(PersistTest):
+class CreateEngineTest(TestBase):
     """test that create_engine arguments of different types get propigated properly"""
     def test_connect_query(self):
         dbapi = MockDBAPI(foober='12', lala='18', fooz='somevalue')
index eb426f029a132c96ead60777bc1dbb1b475ddb22..8e0abb69115ed66a54ed590629379ea4efb76dd0 100644 (file)
@@ -33,7 +33,7 @@ class MockCursor(object):
         pass
 mock_dbapi = MockDBAPI()
 
-class PoolTest(PersistTest):
+class PoolTest(TestBase):
 
     def setUp(self):
         pool.clear_managers()
index 2a18fca2c00ef9042ddb35678508d01f38dd4e50..1b9962523f78bb33fc650d27d3557fb6d36d9cc0 100644 (file)
@@ -43,7 +43,7 @@ class MockCursor(object):
     def close(self):
         pass
 
-class MockReconnectTest(PersistTest):
+class MockReconnectTest(TestBase):
     def setUp(self):
         global db, dbapi
         dbapi = MockDBAPI()
@@ -169,7 +169,7 @@ class MockReconnectTest(PersistTest):
         assert len(dbapi.connections) == 1
 
 
-class RealReconnectTest(PersistTest):
+class RealReconnectTest(TestBase):
     def setUp(self):
         global engine
         engine = engines.reconnecting_engine()
index 3aa6630eb321f17bb045d1673b1458d408e8c366..127a46a1d1d5365c84154f53b3463048e1062a54 100644 (file)
@@ -7,7 +7,7 @@ from testlib import *
 from testlib import engines
 
 
-class ReflectionTest(PersistTest, ComparesTables):
+class ReflectionTest(TestBase, ComparesTables):
 
     @testing.exclude('mysql', '<', (4, 1, 1))
     def test_basic_reflection(self):
@@ -517,7 +517,7 @@ class ReflectionTest(PersistTest, ComparesTables):
             self.assert_(not m9.tables)
 
 
-class CreateDropTest(PersistTest):
+class CreateDropTest(TestBase):
     def setUpAll(self):
         global metadata, users
         metadata = MetaData()
@@ -587,7 +587,7 @@ class CreateDropTest(PersistTest):
         self.assert_(not Set(metadata.tables) - Set(testing.db.table_names()))
         metadata.drop_all(bind=testing.db)
 
-class SchemaManipulationTest(PersistTest):
+class SchemaManipulationTest(TestBase):
     def test_append_constraint_unique(self):
         meta = MetaData()
         
@@ -601,7 +601,7 @@ class SchemaManipulationTest(PersistTest):
         assert len(addresses.c.user_id.foreign_keys) == 1
         assert addresses.constraints == set([addresses.primary_key, fk])
         
-class UnicodeReflectionTest(PersistTest):
+class UnicodeReflectionTest(TestBase):
 
     def test_basic(self):
         try:
@@ -638,7 +638,7 @@ class UnicodeReflectionTest(PersistTest):
             bind.dispose()
 
 
-class SchemaTest(PersistTest):
+class SchemaTest(TestBase):
 
     def test_iteration(self):
         metadata = MetaData()
@@ -700,7 +700,7 @@ class SchemaTest(PersistTest):
             metadata.drop_all()
 
 
-class HasSequenceTest(PersistTest):
+class HasSequenceTest(TestBase):
     def setUpAll(self):
         global metadata, users
         metadata = MetaData()
index 686c640fdba34afcb595570df038143674ed6209..b409703711ffe81f413e5869137f65e3d393ed23 100644 (file)
@@ -6,7 +6,7 @@ from sqlalchemy.orm import *
 from testlib import *
 
 
-class TransactionTest(PersistTest):
+class TransactionTest(TestBase):
     def setUpAll(self):
         global users, metadata
         metadata = MetaData()
@@ -346,7 +346,7 @@ class TransactionTest(PersistTest):
 
         conn.close()
 
-class AutoRollbackTest(PersistTest):
+class AutoRollbackTest(TestBase):
     def setUpAll(self):
         global metadata
         metadata = MetaData()
@@ -375,7 +375,7 @@ class AutoRollbackTest(PersistTest):
         users.drop(conn2)
         conn2.close()
 
-class ExplicitAutoCommitTest(PersistTest):
+class ExplicitAutoCommitTest(TestBase):
     """test the 'autocommit' flag on select() and text() objects.  
     
     Requires Postgres so that we may define a custom function which modifies the database.
@@ -450,7 +450,7 @@ class ExplicitAutoCommitTest(PersistTest):
         conn2.close()
         
     
-class TLTransactionTest(PersistTest):
+class TLTransactionTest(TestBase):
     def setUpAll(self):
         global users, metadata, tlengine
         tlengine = create_engine(testing.db.url, strategy='threadlocal')
@@ -700,7 +700,7 @@ class TLTransactionTest(PersistTest):
         assert c1.connection.connection is not None
 
 
-class ForUpdateTest(PersistTest):
+class ForUpdateTest(TestBase):
     def setUpAll(self):
         global counters, metadata
         metadata = MetaData()
index 39e900e382b924c188128ab2b72d573de2fd3c66..fa112c3b348763796ce41703200cdb2a18605792 100644 (file)
@@ -10,7 +10,7 @@ import sqlalchemy
 from testlib import *
 
 
-class testcase(PersistTest):
+class testcase(TestBase):
     def setUpAll(self):
         clear_mappers()
         objectstore.clear()
@@ -263,7 +263,7 @@ class testcase(PersistTest):
 
         self.assertEquals(Person.query.count(), 2)
 
-class testmanytomany(PersistTest):
+class testmanytomany(TestBase):
      def setUpAll(self):
          clear_mappers()
          objectstore.clear()
@@ -318,7 +318,7 @@ class testmanytomany(PersistTest):
          foo1.bazrel.append(baz1)
          assert (foo1.bazrel == [baz1])
 
-class testselfreferential(PersistTest):
+class testselfreferential(TestBase):
     def setUpAll(self):
         clear_mappers()
         objectstore.clear()
index 188e4bdbb47fe9a5694d3d0553dfd6eae43daed2..1cb2ca3751f74210733ee7f9624b62524d75daa5 100644 (file)
@@ -7,7 +7,7 @@ from sqlalchemy.ext.sessioncontext import SessionContext
 from testlib import *
 
 
-class AssignMapperTest(PersistTest):
+class AssignMapperTest(TestBase):
     def setUpAll(self):
         global metadata, table, table2
         metadata = MetaData(testing.db)
index 1ebf07cb319efab1ae66f121fe904fab48db9b9e..c4c2091edda2d737977e6f7c0e95ce75b593bc89 100644 (file)
@@ -33,7 +33,7 @@ class ObjectCollection(object):
     def __iter__(self):
         return iter(self.values)
 
-class _CollectionOperations(PersistTest):
+class _CollectionOperations(TestBase):
     def setUp(self):
         collection_class = self.collection_class
 
@@ -591,7 +591,7 @@ class CustomObjectTest(_CollectionOperations):
         except TypeError:
             pass
 
-class ScalarTest(PersistTest):
+class ScalarTest(TestBase):
     def test_scalar_proxy(self):
         metadata = MetaData(testing.db)
 
@@ -708,7 +708,7 @@ class ScalarTest(PersistTest):
         p2.bar = 'quux'
 
 
-class LazyLoadTest(PersistTest):
+class LazyLoadTest(TestBase):
     def setUp(self):
         metadata = MetaData(testing.db)
 
index ae1bd94504d7ef968327bd7bf309e00b5cce7e14..ff27a637533e87ec6c47094ef51868920fb383df 100644 (file)
@@ -37,7 +37,7 @@ def alpha_ordering(index, collection):
     s += chr(index + 65)
     return s
 
-class OrderingListTest(PersistTest):
+class OrderingListTest(TestBase):
     def setUp(self):
         global metadata, slides_table, bullets_table, Slide, Bullet
         slides_table, bullets_table = None, None
index 4d58f43ce2de1f6ca2fdfbc5906eff84b7801169..65d70253835341fbcade7875842b393d304392f4 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import *
 from sqlalchemy.orm import *
 from testlib import *
 
-class AssociationTest(PersistTest):
+class AssociationTest(TestBase):
     @testing.uses_deprecated('association option')
     def setUpAll(self):
         global items, item_keywords, keywords, metadata, Item, Keyword, KeywordAssociation
@@ -141,7 +141,7 @@ class AssociationTest(PersistTest):
         sess.flush()
         self.assert_(item_keywords.count().scalar() == 0)
 
-class AssociationTest2(PersistTest):
+class AssociationTest2(TestBase):
     def setUpAll(self):
         global table_originals, table_people, table_isauthor, metadata, Originals, People, IsAuthor
         metadata = MetaData(testing.db)
index c4d817ea9c9ae360aef26277f7a04c30c4bf12ca..92637bc79617ee474b7b58c65cb57883af9937d4 100644 (file)
@@ -8,7 +8,7 @@ from sqlalchemy.ext.sessioncontext import SessionContext
 from testlib import *
 from testlib import fixtures
 
-class EagerTest(AssertMixin):
+class EagerTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global dbmeta, owners, categories, tests, options, Owner, Category, Test, Option, false
         dbmeta = MetaData(testing.db)
@@ -215,7 +215,7 @@ class EagerTest(AssertMixin):
         print result
         assert result == [u'3 Some Category']
 
-class EagerTest2(AssertMixin):
+class EagerTest2(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global metadata, middle, left, right
         metadata = MetaData(testing.db)
index 4b6e5e19b314a75be22dc5a40ddbbe625019ad5c..27860517c114bb9c33abbb00c696e90351eaf589 100644 (file)
@@ -13,7 +13,7 @@ ROLLBACK_SUPPORTED=False
 class MyTest(object):pass
 class MyTest2(object):pass
 
-class AttributesTest(PersistTest):
+class AttributesTest(TestBase):
 
     def test_basic(self):
         class User(object):pass
@@ -435,7 +435,7 @@ class AttributesTest(PersistTest):
             assert False
 
 
-class BackrefTest(PersistTest):
+class BackrefTest(TestBase):
 
     def test_manytomany(self):
         class Student(object):pass
@@ -508,7 +508,7 @@ class BackrefTest(PersistTest):
         j.port = None
         self.assert_(p.jack is None)
 
-class DeferredBackrefTest(PersistTest):
+class DeferredBackrefTest(TestBase):
     def setUp(self):
         global Post, Blog, called, lazy_load
 
@@ -596,7 +596,7 @@ class DeferredBackrefTest(PersistTest):
         called[0] = 0
         lazy_load = (p1, p2, p3) = [Post("post 1"), Post("post 2"), Post("post 3")]
 
-class HistoryTest(PersistTest):
+class HistoryTest(TestBase):
     def test_scalar(self):
         class Foo(fixtures.Base):
             pass
index aa497d81bcb3123fa5a9eeacf33a886e27de796e..7222655776fb98b28c47e7c3c45ce0074914a7dc 100644 (file)
@@ -7,7 +7,7 @@ from sqlalchemy.ext.sessioncontext import SessionContext
 from testlib import *
 import testlib.tables as tables
 
-class O2MCascadeTest(AssertMixin):
+class O2MCascadeTest(TestBase, AssertsExecutionResults):
     def tearDown(self):
         tables.delete()
 
@@ -175,7 +175,7 @@ class O2MCascadeTest(AssertMixin):
         self.assert_(tables.orderitems.count(tables.orders.c.user_id.in_(ids)  &(tables.orderitems.c.order_id==tables.orders.c.order_id)).scalar() == 0)
 
 
-class M2OCascadeTest(AssertMixin):
+class M2OCascadeTest(TestBase, AssertsExecutionResults):
     def tearDown(self):
         ctx.current.clear()
         for t in metadata.table_iterator(reverse=True):
@@ -275,7 +275,7 @@ class M2OCascadeTest(AssertMixin):
 
 
 
-class M2MCascadeTest(AssertMixin):
+class M2MCascadeTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global metadata, a, b, atob
         metadata = MetaData(testing.db)
@@ -470,7 +470,7 @@ class UnsavedOrphansTest2(ORMTest):
         assert item.id is None
         assert attr.id is None
 
-class DoubleParentOrphanTest(AssertMixin):
+class DoubleParentOrphanTest(TestBase, AssertsExecutionResults):
     """test orphan detection for an entity with two parent relations"""
 
     def setUpAll(self):
@@ -537,7 +537,7 @@ class DoubleParentOrphanTest(AssertMixin):
         except exceptions.FlushError, e:
             assert True
 
-class CollectionAssignmentOrphanTest(AssertMixin):
+class CollectionAssignmentOrphanTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global metadata, table_a, table_b
 
index d67ec980cf1fefe75fb998cd6a52f2404af811db..4011ac2ceb215ab51cb27d240e924c3534575237 100644 (file)
@@ -55,7 +55,7 @@ def dictable_entity(a=None, b=None, c=None):
     return Entity(a or str(_id), b or 'value %s' % _id, c)
 
 
-class CollectionsTest(PersistTest):
+class CollectionsTest(TestBase):
     def _test_adapter(self, typecallable, creator=entity_maker,
                       to_set=None):
         class Foo(object):
index 5bcca57df4fed7e9fdffe9fd1e213985f12d4378..31b6860623c4b72bf8d029862f776f5c2d70e5b0 100644 (file)
@@ -5,7 +5,7 @@ from sqlalchemy.orm import *
 from testlib import *
 
 
-class CompileTest(AssertMixin):
+class CompileTest(TestBase, AssertsExecutionResults):
     """test various mapper compilation scenarios"""
     def tearDown(self):
         clear_mappers()
index be61a84fff7c791e3df1895651a98489e39c3aa6..f956a4529b0ee86a3f0a9f32a9daddcf6055bcbb 100644 (file)
@@ -20,7 +20,7 @@ class Tester(object):
     def __repr__(self):
         return "%s(%s)" % (self.__class__.__name__, repr(self.data))
 
-class SelfReferentialTest(AssertMixin):
+class SelfReferentialTest(TestBase, AssertsExecutionResults):
     """tests a self-referential mapper, with an additional list of child objects."""
     def setUpAll(self):
         global t1, t2, metadata
@@ -106,7 +106,7 @@ class SelfReferentialTest(AssertMixin):
         sess.delete(a)
         sess.flush()
 
-class SelfReferentialNoPKTest(AssertMixin):
+class SelfReferentialNoPKTest(TestBase, AssertsExecutionResults):
     """test self-referential relationship that joins on a column other than the primary key column"""
     def setUpAll(self):
         global table, meta
@@ -152,7 +152,7 @@ class SelfReferentialNoPKTest(AssertMixin):
         assert t.uuid == t2.uuid
         assert t.parent.uuid == t1.uuid
 
-class InheritTestOne(AssertMixin):
+class InheritTestOne(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global parent, child1, child2, meta
         meta = MetaData(testing.db)
@@ -353,7 +353,7 @@ class BiDirectionalManyToOneTest(ORMTest):
         sess.save(o3)
         sess.flush()
 
-class BiDirectionalOneToManyTest(AssertMixin):
+class BiDirectionalOneToManyTest(TestBase, AssertsExecutionResults):
     """tests two mappers with a one-to-many relation to each other."""
     def setUpAll(self):
         global t1, t2, metadata
@@ -394,7 +394,7 @@ class BiDirectionalOneToManyTest(AssertMixin):
         [sess.save(x) for x in [a,b,c,d,e,f]]
         sess.flush()
 
-class BiDirectionalOneToManyTest2(AssertMixin):
+class BiDirectionalOneToManyTest2(TestBase, AssertsExecutionResults):
     """tests two mappers with a one-to-many relation to each other, with a second one-to-many on one of the mappers"""
     def setUpAll(self):
         global t1, t2, t3, metadata
@@ -454,7 +454,7 @@ class BiDirectionalOneToManyTest2(AssertMixin):
         sess.delete(c)
         sess.flush()
 
-class OneToManyManyToOneTest(AssertMixin):
+class OneToManyManyToOneTest(TestBase, AssertsExecutionResults):
     """tests two mappers, one has a one-to-many on the other mapper, the other has a separate many-to-one relationship to the first.
     two tests will have a row for each item that is dependent on the other.  without the "post_update" flag, such relationships
     raise an exception when dependencies are sorted."""
@@ -744,7 +744,7 @@ class OneToManyManyToOneTest(AssertMixin):
             )
         ])
 
-class SelfReferentialPostUpdateTest(AssertMixin):
+class SelfReferentialPostUpdateTest(TestBase, AssertsExecutionResults):
     """test using post_update on a single self-referential mapper"""
     def setUpAll(self):
         global metadata, node_table
@@ -848,7 +848,7 @@ class SelfReferentialPostUpdateTest(AssertMixin):
             ),
         ])
 
-class SelfReferentialPostUpdateTest2(AssertMixin):
+class SelfReferentialPostUpdateTest2(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global metadata, a_table
         metadata = MetaData(testing.db)
index c56d22f9d3bdf279c143e58bd5c430e581e89435..760f8fce901c34509ee5d27233b61261131dbed1 100644 (file)
@@ -5,7 +5,7 @@ from sqlalchemy.ext.sessioncontext import SessionContext
 from testlib import *
 from testlib.tables import *
 
-class EntityTest(AssertMixin):
+class EntityTest(TestBase, AssertsExecutionResults):
     """tests mappers that are constructed based on "entity names", which allows the same class
     to have multiple primary mappers """
 
index ee8f10969b734024a7c5f5a41361ea558e7281d0..9967f34f7e310972ed96714ca325052b6846a180 100644 (file)
@@ -12,7 +12,7 @@ class Foo(object):
         for k in kwargs:
             setattr(self, k, kwargs[k])
 
-class GenerativeQueryTest(PersistTest):
+class GenerativeQueryTest(TestBase):
     def setUpAll(self):
         global foo, metadata
         metadata = MetaData(testing.db)
@@ -119,7 +119,7 @@ class Obj1(object):
 class Obj2(object):
     pass
 
-class GenerativeTest2(PersistTest):
+class GenerativeTest2(TestBase):
     def setUpAll(self):
         global metadata, table1, table2
         metadata = MetaData()
@@ -149,7 +149,7 @@ class GenerativeTest2(PersistTest):
         res = query.filter(and_(table1.c.id==table2.c.t1id,table2.c.t1id==1)).distinct()
         self.assertEqual(res.count(), 1)
 
-class RelationsTest(AssertMixin):
+class RelationsTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         tables.create()
         tables.data()
@@ -206,7 +206,7 @@ class RelationsTest(AssertMixin):
         self.assert_result(list(x), tables.User, *tables.user_result[1:3])
 
 
-class CaseSensitiveTest(PersistTest):
+class CaseSensitiveTest(TestBase):
     def setUpAll(self):
         global metadata, table1, table2
         metadata = MetaData(testing.db)
index 75ec0c2b5ae11e139f756d03c28501a118282b32..ae3f4eaf610a4b76f7fa67c3f1625a25e564e756 100644 (file)
@@ -612,7 +612,7 @@ class RelationTest7(ORMTest):
         for p in r:
             assert p.car_id == p.car.car_id
 
-class GenerativeTest(AssertMixin):
+class GenerativeTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         #  cars---owned by---  people (abstract) --- has a --- status
         #   |                  ^    ^                            |
index 22ca25bf0c9f2837441520dcbc5b80e631bd14bd..81223cc02e36445b757e61ed953706a01c3169d4 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy.orm import *
 from testlib import *
 
 
-class SingleInheritanceTest(AssertMixin):
+class SingleInheritanceTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         metadata = MetaData(testing.db)
         global employees_table
index 40f425abe8256839aa8405bafee61f97338a8d9c..90cbbe2086d94435878e5af6c4ffcb649c6a8115 100644 (file)
@@ -3,7 +3,7 @@ from sqlalchemy import *
 from sqlalchemy.orm import *
 from testlib import *
 
-class LazyTest(AssertMixin):
+class LazyTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global info_table, data_table, rel_table, metadata
         metadata = MetaData(testing.db)
index a8f75a31b808a518b10b0f16d380086ce99a301d..6d36b7216eb74e33e762e76d86cb44d605a19e0f 100644 (file)
@@ -10,7 +10,7 @@ from testlib.tables import *
 import testlib.tables as tables
 
 
-class MapperSuperTest(AssertMixin):
+class MapperSuperTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         tables.create()
         tables.data()
@@ -1238,7 +1238,7 @@ class NoLoadTest(MapperSuperTest):
             {'user_id' : 7, 'addresses' : (Address, [{'address_id' : 1}])},
             )
 
-class MapperExtensionTest(PersistTest):
+class MapperExtensionTest(TestBase):
     def setUpAll(self):
         tables.create()
 
@@ -1387,7 +1387,7 @@ class MapperExtensionTest(PersistTest):
         self.assertEquals(methods, ['before_insert', 'after_insert', 'load', 'translate_row', 'populate_instance', 'get',
             'translate_row', 'create_instance', 'populate_instance', 'before_update', 'after_update', 'before_delete', 'after_delete'])
 
-class RequirementsTest(AssertMixin):
+class RequirementsTest(TestBase, AssertsExecutionResults):
     """Tests the contract for user classes."""
 
     def setUpAll(self):
index 87471842fde4ee276220aadc87b6651266bc212e..2b3081c6bfc7a956b61eda19f7b6cff410e2a115 100644 (file)
@@ -37,7 +37,7 @@ def assert_no_mappers():
     gc.collect()
     assert len(_mapper_registry) == 0
 
-class EnsureZeroed(AssertMixin):
+class EnsureZeroed(TestBase, AssertsExecutionResults):
     def setUp(self):
         _sessions.clear()
         _mapper_registry.clear()
index cbaf752d1fbf6e942f73b30f1eb7df9c2538d796..b9a2472895d68bbbc99cd8e23f6815c4d497088e 100644 (file)
@@ -8,7 +8,7 @@ from testlib import fixtures
 from testlib.tables import *
 import testlib.tables as tables
 
-class MergeTest(AssertMixin):
+class MergeTest(TestBase, AssertsExecutionResults):
     """tests session.merge() functionality"""
     def setUpAll(self):
         tables.create()
index 9c1ea9f165021d4863643e64ecf92ca69aef40ba..ae0d6ef86dc506b23aa8dc80c53426ed80328cab 100644 (file)
@@ -24,7 +24,7 @@ class Port(object):
         self.name=name
         self.description = description
 
-class O2OTest(AssertMixin):
+class O2OTest(TestBase, AssertsExecutionResults):
     @testing.uses_deprecated('SessionContext')
     def setUpAll(self):
         global jack, port, metadata, ctx
index 40f70bf6271f1cdc7daa84e6c82997bd1d7e4309..287ee053c6d2ed73bf51253d050a714a653292d3 100644 (file)
@@ -7,7 +7,7 @@ from sqlalchemy.orm import collections
 from sqlalchemy.orm.collections import collection
 from testlib import *
 
-class RelationTest(PersistTest):
+class RelationTest(TestBase):
     """An extended topological sort test
 
     This is essentially an extension of the "dependency.py" topological sort
@@ -104,7 +104,7 @@ class RelationTest(PersistTest):
         session.delete(c) # fails
         session.flush()
 
-class RelationTest2(PersistTest):
+class RelationTest2(TestBase):
     """Tests a relationship on a column included in multiple foreign keys.
 
     This test tests a relationship on a column that is included in multiple
@@ -228,7 +228,7 @@ class RelationTest2(PersistTest):
         assert sess.query(Employee).get([c1.company_id, 3]).reports_to.name == 'emp1'
         assert sess.query(Employee).get([c2.company_id, 3]).reports_to.name == 'emp5'
 
-class RelationTest3(PersistTest):
+class RelationTest3(TestBase):
     def setUpAll(self):
         global jobs, pageversions, pages, metadata, Job, Page, PageVersion, PageComment
         import datetime
index 0a38198ac2eef8271435b9b787af4e78fe18f3e1..a1c850073e965e6c85956860a855e28ecfdb7351 100644 (file)
@@ -11,7 +11,7 @@ import pickle
 import gc
 
 
-class SessionTest(AssertMixin):
+class SessionTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         tables.create()
 
@@ -967,7 +967,7 @@ class ScopedSessionTest(ORMTest):
         self.assertEquals(SomeObject(id=1, data="hello", options=[SomeOtherObject(someid=1)]), SomeObject.query.one())
         self.assertEquals(SomeOtherObject(someid=1), SomeOtherObject.query.filter(SomeOtherObject.someid==sso.someid).one())
 
-class ScopedMapperTest(PersistTest):
+class ScopedMapperTest(TestBase):
     def setUpAll(self):
         global metadata, table, table2
         metadata = MetaData(testing.db)
index d6e652477bad1400fd003d980a363adc00ff7f77..c743dabf99124b59bc1db77dd238aa2e4adddb6c 100644 (file)
@@ -12,7 +12,7 @@ users = Table('users', metadata,
     Column('user_name', String(40)),
 )
 
-class SessionContextTest(AssertMixin):
+class SessionContextTest(TestBase, AssertsExecutionResults):
     def setUp(self):
         clear_mappers()
 
index 283fac0e325982e47f01765de429d917d4ab63c7..f0acb1a719d3b9b4a640a891ab7f6850ca2c10d9 100644 (file)
@@ -5,11 +5,11 @@ from sqlalchemy import exceptions, sql
 from sqlalchemy.orm import *
 from sqlalchemy.orm.shard import ShardedSession
 from sqlalchemy.sql import operators
-from testlib import PersistTest
+from testlib import TestBase
 
 # TODO: ShardTest can be turned into a base for further subclasses
 
-class ShardTest(PersistTest):
+class ShardTest(TestBase):
     def setUpAll(self):
         global db1, db2, db3, db4, weather_locations, weather_reports
 
index 6fdda3f4d4769a26d88e2a54557b702a670ebbcc..83433308383e50404e46be72159b0d11bc043c0a 100644 (file)
@@ -17,7 +17,7 @@ top while it runs
 
 NUM = 2500
 
-class LoadTest(AssertMixin):
+class LoadTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global items, meta
         meta = MetaData(testing.db)
index c0d041a41df1a4bd22602ca149a978288cbc2417..bf65c8fdf70024a66141087c9714d36021dc5838 100644 (file)
@@ -7,7 +7,7 @@ from testlib import *
 
 NUM = 2500
 
-class SaveTest(AssertMixin):
+class SaveTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global items, metadata
         metadata = MetaData(testing.db)
index 0a050358a51f68c318fac70162d13800b799106b..c5f7686531f297c61e2a92c68573247a936aef68 100644 (file)
@@ -9,7 +9,7 @@ import gc
 
 ITERATIONS = 100
 
-class SessionTest(AssertMixin):
+class SessionTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global t1, t2, metadata,T1, T2
         metadata = MetaData(testing.db)
index 330271a1cb20cd17a31026afbb866b2ff728729f..51ec25e38cef7d1f73aaa625da58922af049a704 100644 (file)
@@ -3,7 +3,7 @@ from sqlalchemy import *
 from testlib import *
 
 
-class CompileTest(AssertMixin):
+class CompileTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global t1, t2, metadata
         metadata = MetaData()
index 92c4883823d2d5fa6ef5c9757920efd126b8f74f..a8167a1ba39d3f4e9e5c9b516c1700ff014ae8e5 100644 (file)
@@ -4,7 +4,7 @@ from testlib import *
 from sqlalchemy.pool import QueuePool
 from sqlalchemy.databases import sqlite
 
-class QueuePoolTest(AssertMixin):
+class QueuePoolTest(TestBase, AssertsExecutionResults):
     def setUp(self):
         global pool
         pool = QueuePool(creator = lambda: sqlite.SQLiteDialect.dbapi().connect(':memory:'), pool_size = 3, max_overflow = -1, use_threadlocal = True)
index f78036123c978e3d0a29e43e253d7143b499adde..f0208acb4ac5378f10f7dc6a016ada19c0f73a8d 100644 (file)
@@ -7,16 +7,15 @@ import datetime
 import sys
 import time
 import testenv; testenv.configure_for_tests()
-from testlib import engines, testing, profiling
 from sqlalchemy import *
-from testlib import set
+from testlib import *
 
 ITERATIONS = 1
 
 _run_type = 'suite'
 _running_in = lambda: _run_type
 
-class ZooMarkTest(testing.AssertMixin):
+class ZooMarkTest(testing.TestBase, AssertsExecutionResults):
     """Runs the ZooMark and squawks if method counts vary from the norm.
 
     Each test has an associated `call_range`, the total number of accepted
@@ -29,7 +28,7 @@ class ZooMarkTest(testing.AssertMixin):
 
     @profiling.conditional_call_count(
         _running_in, {'isolation': (1806,),
-                      'suite': (1569, {'2.4': 1579})})
+                      'suite': (1569, {'2.4': 1579}, 0.20)})
     def test_1_create_tables(self):
         global metadata
         metadata = MetaData(testing.db)
index 6476537b0f8b1dcdb8609c793712e2454d8478f2..ab68b52109f4f91ad521c3a9d88aae4f2037b12d 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import *
 from testlib import *
 
 
-class CaseTest(PersistTest):
+class CaseTest(TestBase):
 
     def setUpAll(self):
         metadata = MetaData(testing.db)
index 29fffa7512544f23e96f4599b4ecde0269438796..2908e07da929ef10da54ed59a20567c99cf120af 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import exceptions
 from testlib import *
 from testlib import config, engines
 
-class ConstraintTest(AssertMixin):
+class ConstraintTest(TestBase, AssertsExecutionResults):
 
     def setUp(self):
         global metadata
@@ -202,7 +202,7 @@ class ConstraintTest(AssertMixin):
         ss = events.select().execute().fetchall()
 
 
-class ConstraintCompilationTest(AssertMixin):
+class ConstraintCompilationTest(TestBase, AssertsExecutionResults):
     class accum(object):
         def __init__(self):
             self.statements = []
index 9b8485231d1cd3e2576e2c00d7b89c88084572b6..22660c0607b568ee2b9eae156884474fcd71e736 100644 (file)
@@ -6,7 +6,7 @@ from sqlalchemy.orm import mapper, create_session
 from testlib import *
 
 
-class DefaultTest(PersistTest):
+class DefaultTest(TestBase):
 
     def setUpAll(self):
         global t, f, f2, ts, currenttime, metadata, default_generator
@@ -267,7 +267,7 @@ class DefaultTest(PersistTest):
         finally:
             testing.db.execute("drop table speedy_users", None)
 
-class PKDefaultTest(PersistTest):
+class PKDefaultTest(TestBase):
     def setUpAll(self):
         global metadata, t1, t2
 
@@ -296,7 +296,7 @@ class PKDefaultTest(PersistTest):
         assert r.last_inserted_ids() == [2]
 
 
-class AutoIncrementTest(PersistTest):
+class AutoIncrementTest(TestBase):
     def setUp(self):
         global aitable, aimeta
 
@@ -406,7 +406,7 @@ class AutoIncrementTest(PersistTest):
             metadata.drop_all()
 
 
-class SequenceTest(PersistTest):
+class SequenceTest(TestBase):
     __unsupported_on__ = ('sqlite', 'mysql', 'mssql', 'firebird',
                           'sybase', 'access')
 
index fe4bbd7acc2c6dd6c5aae381232ff1ebb4cbab31..f6b1e67f182ec26e6e913f65a4a101545caa8644 100644 (file)
@@ -21,7 +21,7 @@ if testing.db.name not in databases.__all__:
     dialects.append(testing.db.dialect)
 
 
-class CompileTest(SQLCompileTest):
+class CompileTest(TestBase, AssertsCompiledSQL):
     def test_compile(self):
         for dialect in dialects:
             bindtemplate = BIND_TEMPLATES[dialect.paramstyle]
@@ -139,7 +139,7 @@ class CompileTest(SQLCompileTest):
             , checkparams={'y_1': 45, 'x_1': 17, 'y_2': 12, 'x_2': 5})
 
 
-class ExecuteTest(PersistTest):
+class ExecuteTest(TestBase):
 
     def test_standalone_execute(self):
         x = testing.db.func.current_date().execute().scalar()
index 26d78c6f03ce12bba29c554d03ef46e5f2c59669..831c2e2873660d2081045682a327a613bc48574a 100644 (file)
@@ -8,7 +8,7 @@ from sqlalchemy import util
 from sqlalchemy.sql import util as sql_util
 
 
-class TraversalTest(AssertMixin):
+class TraversalTest(TestBase, AssertsExecutionResults):
     """test ClauseVisitor's traversal, particularly its ability to copy and modify
     a ClauseElement in place."""
 
@@ -138,7 +138,7 @@ class TraversalTest(AssertMixin):
         assert struct3 == s3
 
 
-class ClauseTest(SQLCompileTest):
+class ClauseTest(TestBase, AssertsCompiledSQL):
     """test copy-in-place behavior of various ClauseElements."""
 
     def setUpAll(self):
@@ -270,7 +270,7 @@ class ClauseTest(SQLCompileTest):
 
         self.assert_compile(Vis().traverse(s, clone=True), "SELECT * FROM table1 WHERE table1.col1 = table2.col1 AND table1.col2 = :table1_col2_1")
 
-class ClauseAdapterTest(SQLCompileTest):
+class ClauseAdapterTest(TestBase, AssertsCompiledSQL):
     def setUpAll(self):
         global t1, t2
         t1 = table("table1",
@@ -410,7 +410,7 @@ class ClauseAdapterTest(SQLCompileTest):
             "LEFT OUTER JOIN table1 AS bar ON anon_1.col1 = bar.col1")
 
 
-class SelectTest(SQLCompileTest):
+class SelectTest(TestBase, AssertsCompiledSQL):
     """tests the generative capability of Select"""
 
     def setUpAll(self):
index 8164d7f7787dc4f803696bb2cfb9fc5f5e9286cb..a46d0a65083da0684eab49cece31372fb6cc65d2 100644 (file)
@@ -8,7 +8,7 @@ from sqlalchemy.engine import default
 
 IDENT_LENGTH = 29
 
-class LabelTypeTest(PersistTest):
+class LabelTypeTest(TestBase):
     def test_type(self):
         m = MetaData()
         t = Table('sometable', m,
@@ -17,7 +17,7 @@ class LabelTypeTest(PersistTest):
         assert isinstance(t.c.col1.label('hi').type, Integer)
         assert isinstance(select([t.c.col2]).as_scalar().label('lala').type, Float)
 
-class LongLabelsTest(SQLCompileTest):
+class LongLabelsTest(TestBase, AssertsCompiledSQL):
     def setUpAll(self):
         global metadata, table1, maxlen
         metadata = MetaData(testing.db)
index 19d11a2f1f69f6873e2690b8931fe2c3066b8ac6..533f40fb5f5b29d1d768daf454fe1793f54922ab 100644 (file)
@@ -6,7 +6,7 @@ from sqlalchemy.engine import default
 from testlib import *
 
 
-class QueryTest(PersistTest):
+class QueryTest(TestBase):
 
     def setUpAll(self):
         global users, addresses, metadata
@@ -557,7 +557,7 @@ class QueryTest(PersistTest):
         assert len(r) == 1
 
 
-class CompoundTest(PersistTest):
+class CompoundTest(TestBase):
     """test compound statements like UNION, INTERSECT, particularly their ability to nest on
     different databases."""
     def setUpAll(self):
@@ -755,7 +755,7 @@ class CompoundTest(PersistTest):
         self.assertEquals(found, wanted)
 
 
-class JoinTest(PersistTest):
+class JoinTest(TestBase):
     """Tests join execution.
 
     The compiled SQL emitted by the dialect might be ANSI joins or
@@ -1025,7 +1025,7 @@ class JoinTest(PersistTest):
             self.assertRows(expr, [(10, 20, 30)])
 
 
-class OperatorTest(PersistTest):
+class OperatorTest(TestBase):
     def setUpAll(self):
         global metadata, flds
         metadata = MetaData(testing.db)
index ee71648361c595dfcf895cd4dff9cbfb67f3f0b4..825e836ff86e9440a36f606e71274b596f004b3d 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy import sql
 from sqlalchemy.sql import compiler
 from testlib import *
 
-class QuoteTest(PersistTest):
+class QuoteTest(TestBase):
     def setUpAll(self):
         # TODO: figure out which databases/which identifiers allow special characters to be used,
         # such as:  spaces, quote characters, punctuation characters, set up tests for those as
@@ -98,7 +98,7 @@ class QuoteTest(PersistTest):
         assert str(x) == '''SELECT "SomeLabel" \nFROM (SELECT 'FooCol' AS "SomeLabel" \nFROM "ImATable")'''
 
 
-class PreparerTest(PersistTest):
+class PreparerTest(TestBase):
     """Test the db-agnostic quoting services of IdentifierPreparer."""
 
     def test_unformat(self):
index dc90c1945799b551161fdbb6e26595c4dc75e5ad..3c9caad75424c8f3d2240b4280faa73451e16373 100644 (file)
@@ -3,7 +3,7 @@ from sqlalchemy import *
 from testlib import *
 
 
-class FoundRowsTest(AssertMixin):
+class FoundRowsTest(TestBase, AssertsExecutionResults):
     """tests rowcount functionality"""
     def setUpAll(self):
         metadata = MetaData(testing.db)
index 54b1e87a2c57352041eb7c8f6d17a0fb3429ce86..39906dcdb97b0864465455032f187770abe36eb0 100644 (file)
@@ -48,7 +48,7 @@ addresses = table('addresses',
     column('zip')
 )
 
-class SelectTest(SQLCompileTest):
+class SelectTest(TestBase, AssertsCompiledSQL):
 
     def test_attribute_sanity(self):
         assert hasattr(table1, 'c')
@@ -1198,7 +1198,7 @@ UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE
             else:
                 self.assert_compile(s1, "SELECT %s FROM (SELECT %s FROM mytable)" % (expr,expr))
                 
-class CRUDTest(SQLCompileTest):
+class CRUDTest(TestBase, AssertsCompiledSQL):
     def test_insert(self):
         # generic insert, will create bind params for all columns
         self.assert_compile(insert(table1), "INSERT INTO mytable (myid, name, description) VALUES (:myid, :name, :description)")
@@ -1304,7 +1304,7 @@ class CRUDTest(SQLCompileTest):
         u = table1.delete(table1.c.name==s)
         self.assert_compile(u, "DELETE FROM mytable WHERE mytable.name = (SELECT myothertable.othername FROM myothertable WHERE myothertable.otherid = mytable.myid)")
 
-class InlineDefaultTest(SQLCompileTest):
+class InlineDefaultTest(TestBase, AssertsCompiledSQL):
     def test_insert(self):
         m = MetaData()
         foo =  Table('foo', m,
@@ -1330,7 +1330,7 @@ class InlineDefaultTest(SQLCompileTest):
 
         self.assert_compile(t.update(inline=True, values={'col3':'foo'}), "UPDATE test SET col1=foo(:foo_1), col2=(SELECT coalesce(max(foo.id)) AS coalesce_1 FROM foo), col3=:col3")
 
-class SchemaTest(SQLCompileTest):
+class SchemaTest(TestBase, AssertsCompiledSQL):
     @testing.fails_on('mssql')
     def test_select(self):
         # these tests will fail with the MS-SQL compiler since it will alias schema-qualified tables
index fe2f41b2bbda000962e26bda6aa77996c0675411..c93c6282591afafb026761053ee14bb0f33a0c06 100755 (executable)
@@ -23,7 +23,7 @@ table2 = Table('table2', metadata,
     Column('coly', Integer),
 )
 
-class SelectableTest(AssertMixin):
+class SelectableTest(TestBase, AssertsExecutionResults):
     def testdistance(self):
         # same column three times
         s = select([table.c.col1.label('c2'), table.c.col1, table.c.col1.label('c1')])
@@ -212,7 +212,7 @@ class SelectableTest(AssertMixin):
         assert u.corresponding_column(s.oid_column) is u.oid_column
         assert u.corresponding_column(s2.oid_column) is u.oid_column
     
-class PrimaryKeyTest(AssertMixin):
+class PrimaryKeyTest(TestBase, AssertsExecutionResults):
     def test_join_pk_collapse_implicit(self):
         """test that redundant columns in a join get 'collapsed' into a minimal primary key,
         which is the root column along a chain of foreign key relationships."""
@@ -297,7 +297,7 @@ class PrimaryKeyTest(AssertMixin):
         )
 
 
-class ReduceTest(AssertMixin):
+class ReduceTest(TestBase, AssertsExecutionResults):
     def test_reduce(self):
         meta = MetaData()
         t1 = Table('t1', meta,
@@ -411,7 +411,7 @@ class ReduceTest(AssertMixin):
         )    
     
             
-class DerivedTest(AssertMixin):
+class DerivedTest(TestBase, AssertsExecutionResults):
     def test_table(self):
         meta = MetaData()
         t1 = Table('t1', meta, Column('c1', Integer, primary_key=True), Column('c2', String(30)))
index b8de2a302dc41b3347bda44cffd6ac807f1c66bb..0c10247e594667e02b40adc3cb6ece15ef426e98 100644 (file)
@@ -9,7 +9,7 @@ from testlib import *
 
 
 
-class AdaptTest(PersistTest):
+class AdaptTest(TestBase):
     def testadapt(self):
         e1 = url.URL('postgres').get_dialect()()
         e2 = url.URL('mysql').get_dialect()()
@@ -106,7 +106,7 @@ class AdaptTest(PersistTest):
 
 
 
-class UserDefinedTest(PersistTest):
+class UserDefinedTest(TestBase):
     """tests user-defined types."""
 
     def testbasic(self):
@@ -266,7 +266,7 @@ class UserDefinedTest(PersistTest):
     def tearDownAll(self):
         metadata.drop_all()
 
-class ColumnsTest(AssertMixin):
+class ColumnsTest(TestBase, AssertsExecutionResults):
 
     def testcolumns(self):
         expectedResults = { 'int_column': 'int_column INTEGER',
@@ -299,7 +299,7 @@ class ColumnsTest(AssertMixin):
                 db.dialect.schemagenerator(db.dialect, db, None, None).\
                   get_column_specification(aCol))
 
-class UnicodeTest(AssertMixin):
+class UnicodeTest(TestBase, AssertsExecutionResults):
     """tests the Unicode type.  also tests the TypeDecorator with instances in the types package."""
     def setUpAll(self):
         global unicode_table
@@ -400,7 +400,7 @@ class UnicodeTest(AssertMixin):
         teststr = u'aaa\x1234'
         self.assert_(testing.db.func.length(teststr).scalar() == len(teststr))
 
-class BinaryTest(AssertMixin):
+class BinaryTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global binary_table, MyPickleType
 
@@ -467,7 +467,7 @@ class BinaryTest(AssertMixin):
         # put a number less than the typical MySQL default BLOB size
         return file(f).read(len)
 
-class ExpressionTest(AssertMixin):
+class ExpressionTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global test_table, meta
 
@@ -537,7 +537,7 @@ class ExpressionTest(AssertMixin):
         # processing rules on the column.
         assert testing.db.execute(select([expr])).scalar() == -15
 
-class DateTest(AssertMixin):
+class DateTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global users_with_date, insert_data
 
@@ -662,7 +662,7 @@ class DateTest(AssertMixin):
         finally:
             t.drop(checkfirst=True)
 
-class StringTest(AssertMixin):
+class StringTest(TestBase, AssertsExecutionResults):
     def test_nolen_string_deprecated(self):
         metadata = MetaData(testing.db)
         foo =Table('foo', metadata,
@@ -698,7 +698,7 @@ def _missing_decimal():
     except ImportError:
         return True
 
-class NumericTest(AssertMixin):
+class NumericTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global numeric_table, metadata
         metadata = MetaData(testing.db)
@@ -750,7 +750,7 @@ class NumericTest(AssertMixin):
             assert isinstance(row['fcasdec'], util.decimal_type)
 
 
-class IntervalTest(AssertMixin):
+class IntervalTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global interval_table, metadata
         metadata = MetaData(testing.db)
@@ -775,7 +775,7 @@ class IntervalTest(AssertMixin):
         interval_table.insert().execute(id=1, inverval=None)
         assert interval_table.select().execute().fetchone()['interval'] is None
 
-class BooleanTest(AssertMixin):
+class BooleanTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global bool_table
         metadata = MetaData(testing.db)
index 54d4530257d901fc67c3cc0e6a686fe38717a67a..9e3ea257e558693381d6e37e6b1f7946a62419dc 100644 (file)
@@ -7,7 +7,7 @@ from testlib import *
 from testlib.engines import utf8_engine
 from sqlalchemy.sql import column
 
-class UnicodeSchemaTest(PersistTest):
+class UnicodeSchemaTest(TestBase):
     @testing.unsupported('maxdb', 'oracle', 'sybase')
     def setUpAll(self):
         global unicode_bind, metadata, t1, t2, t3
@@ -112,7 +112,7 @@ class UnicodeSchemaTest(PersistTest):
         meta.drop_all()
         metadata.create_all()
 
-class EscapesDefaultsTest(testing.PersistTest):
+class EscapesDefaultsTest(testing.TestBase):
     def test_default_exec(self):
         metadata = MetaData(testing.db)
         t1 = Table('t1', metadata,
index 1cb3647e21daea4e98033696bbffedfe5c0eeb44..98552b0f39fd8fc5b3c790868e545e16f03290d2 100644 (file)
@@ -8,7 +8,7 @@ from testlib.schema import Table, Column
 from testlib.orm import mapper
 import testlib.testing as testing
 from testlib.testing import rowset
-from testlib.testing import PersistTest, AssertMixin, ORMTest, SQLCompileTest, ComparesTables
+from testlib.testing import TestBase, AssertsExecutionResults, ORMTest, AssertsCompiledSQL, ComparesTables
 import testlib.profiling as profiling
 import testlib.engines as engines
 from testlib.compat import set, frozenset, sorted, _function_named
@@ -18,6 +18,6 @@ __all__ = ('testing',
            'mapper',
            'Table', 'Column',
            'rowset',
-           'PersistTest', 'AssertMixin', 'ORMTest', 'SQLCompileTest', 'ComparesTables',
+           'TestBase', 'AssertsExecutionResults', 'ORMTest', 'AssertsCompiledSQL', 'ComparesTables',
            'profiling', 'engines',
            'set', 'frozenset', 'sorted', '_function_named')
index 5c37f95bd9143eeb9da97364e5d9c015d0e8155b..8a30287996330c90f4cdafed62688fb66f47e472 100644 (file)
@@ -10,7 +10,7 @@ from testlib.compat import *
 sql, sqltypes, schema, MetaData, clear_mappers, Session, util = None, None, None, None, None, None, None
 sa_exceptions = None
 
-__all__ = ('PersistTest', 'AssertMixin', 'ComparesTables', 'ORMTest', 'SQLCompileTest')
+__all__ = ('TestBase', 'AssertsExecutionResults', 'ComparesTables', 'ORMTest', 'AssertsCompiledSQL')
 
 _ops = { '<': operator.lt,
          '>': operator.gt,
@@ -434,7 +434,7 @@ class ExecutionContextWrapper(object):
             query = re.sub(r':([\w_]+)', repl, query)
         return query
 
-class PersistTest(unittest.TestCase):
+class TestBase(unittest.TestCase):
     # A sequence of dialect names to exclude from the test class.
     __unsupported_on__ = ()
 
@@ -464,7 +464,7 @@ class PersistTest(unittest.TestCase):
     if not hasattr(unittest.TestCase, 'assertFalse'):
         assertFalse = unittest.TestCase.failIf
 
-class SQLCompileTest(PersistTest):
+class AssertsCompiledSQL(object):
     def assert_compile(self, clause, result, params=None, checkparams=None, dialect=None):
         if dialect is None:
             dialect = getattr(self, '__dialect__', None)
@@ -519,7 +519,7 @@ class ComparesTables(object):
             assert reflected_table.primary_key.columns[c.name]
 
     
-class AssertMixin(PersistTest):
+class AssertsExecutionResults(object):
     def assert_result(self, result, class_, *objects):
         result = list(result)
         print repr(result)
@@ -629,7 +629,7 @@ class AssertMixin(PersistTest):
             testdata.buffer = None
 
 _otest_metadata = None
-class ORMTest(AssertMixin):
+class ORMTest(TestBase, AssertsExecutionResults):
     keep_mappers = False
     keep_data = False
     metadata = None
@@ -690,7 +690,7 @@ class TTestSuite(unittest.TestSuite):
     """A TestSuite with once per TestCase setUpAll() and tearDownAll()"""
 
     def __init__(self, tests=()):
-        if len(tests) > 0 and isinstance(tests[0], PersistTest):
+        if len(tests) > 0 and isinstance(tests[0], TestBase):
             self._initTest = tests[0]
         else:
             self._initTest = None
index 06647308559afad6a148c0cef8d80dc89a143ba5..4f77d350d36e8870d7387bc4fcbab07d00fbaca7 100644 (file)
@@ -7,7 +7,7 @@ from zblog.user import *
 from zblog.blog import *
 
 
-class ZBlogTest(AssertMixin):
+class ZBlogTest(TestBase, AssertsExecutionResults):
 
     def create_tables(self):
         tables.metadata.drop_all(bind=testing.db)