diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-20 18:18:17 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-20 18:18:17 -0400 |
commit | 2ccd77e5dc6e389159a64f7aed39b9785580a01c (patch) | |
tree | 05897cd208a950c782c454a3b2e016a7e7a9b919 /test/lib/fixtures.py | |
parent | aef0c7a903464f4e05496c69ff4e78d41239c220 (diff) | |
download | sqlalchemy-2ccd77e5dc6e389159a64f7aed39b9785580a01c.tar.gz |
- [feature] The Query.update() method is now
more lenient as to the table
being updated. Plain Table objects are better
supported now, and additional a joined-inheritance
subclass may be used with update(); the subclass
table will be the target of the update,
and if the parent table is referenced in the
WHERE clause, the compiler will call upon
UPDATE..FROM syntax as allowed by the dialect
to satisfy the WHERE clause. Target columns
must still be in the target table i.e.
does not support MySQL's multi-table update
feature (even though this is in Core).
PG's DELETE..USING is also not available
in Core yet.
Diffstat (limited to 'test/lib/fixtures.py')
-rw-r--r-- | test/lib/fixtures.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/test/lib/fixtures.py b/test/lib/fixtures.py index af4b0d5bb..15a3d6b03 100644 --- a/test/lib/fixtures.py +++ b/test/lib/fixtures.py @@ -116,7 +116,7 @@ class TablesTest(TestBase): def _teardown_each_tables(self): # no need to run deletes if tables are recreated on setup - if self.run_define_tables != 'each' and self.run_deletes: + if self.run_define_tables != 'each' and self.run_deletes == 'each': for table in reversed(self.metadata.sorted_tables): try: table.delete().execute().close() @@ -303,23 +303,12 @@ class MappedTest(_ORMTest, TablesTest, testing.AssertsExecutionResults): pass class DeclarativeMappedTest(MappedTest): - declarative_meta = None - run_setup_classes = 'once' run_setup_mappers = 'once' @classmethod - def setup_class(cls): - if cls.declarative_meta is None: - cls.declarative_meta = sa.MetaData() - - super(DeclarativeMappedTest, cls).setup_class() - - @classmethod - def _teardown_once_class(cls): - if cls.declarative_meta.tables: - cls.declarative_meta.drop_all(testing.db) - super(DeclarativeMappedTest, cls)._teardown_once_class() + def _setup_once_tables(cls): + pass @classmethod def _with_register_classes(cls, fn): @@ -331,10 +320,10 @@ class DeclarativeMappedTest(MappedTest): cls, classname, bases, dict_) class DeclarativeBasic(object): __table_cls__ = schema.Table - _DeclBase = declarative_base(metadata=cls.declarative_meta, + _DeclBase = declarative_base(metadata=cls.metadata, metaclass=FindFixtureDeclarative, cls=DeclarativeBasic) cls.DeclarativeBasic = _DeclBase fn() - if cls.declarative_meta.tables: - cls.declarative_meta.create_all(testing.db) + if cls.metadata.tables: + cls.metadata.create_all(testing.db) |