Matt Wilson
no leída,5 dic 2007, 10:41:33 a.m.5/12/2007Accede para responder al autor
Accede para reenviar el mensaje
No tienes permiso para borrar mensajes de este grupo
Mostrar el mensaje original
Las direcciones de correo electrónico son anónimas para este grupo, o bien, necesitas un permiso que te permita visualizar las direcciones de correo electrónico de los miembros a fin de ver el mensaje original
para TurboGears Trunk
Revision 3809 made this change to the testutil DBTest class
$ svn diff --diff-cmd=diff -r PREV:HEAD testutil.py
Index: testutil.py
===================================================================
--- testutil.py (revision 3757)
+++ testutil.py (revision 3809)
@@ -159,13 +159,20 @@
class DBTest(unittest.TestCase):
model = None
+ def _get_soClasses(self):
+ try:
+ return [self.model.__dict__[x] for x in
self.model.soClasses]
+
+ except AttributeError:
+ return self.model.__dict__.values()
+
def setUp(self):
if not self.model:
self.model = get_model()
if not self.model:
raise "Unable to run database tests without a model"
- for item in self.model.__dict__.values():
+ for item in self._get_soClasses():
if isinstance(item, types.TypeType) and issubclass(item,
sqlobject.SQLObject) and item != sqlobject.SQLObject
\
and item != InheritableSQLObject:
@@ -173,7 +180,7 @@
def tearDown(self):
database.rollback_all()
- for item in self.model.__dict__.values():
+ for item in self._get_soClasses():
if isinstance(item, types.TypeType) and issubclass(item,
sqlobject.SQLObject) and item != sqlobject.SQLObject
\
and item != InheritableSQLObject:
In the teardown case, shouldn't the tables be deleted in the reversed
order, so that the dependent tables are destroyed before the tables
that they depend on?