Right now, the teardown function in testutil.py uses the optional soClasses list. I think it should go through it backwards, so that it destroys the dependent tables first.
This diff shows my suggested change:
[matt@coleridge: 0.08] ~/svn-checkouts/turbogears/turbogears
$ svn diff --diff-cmd=/usr/bin/diff testutil.py
Index: testutil.py
===================================================================
--- testutil.py (revision 3870)
+++ testutil.py (working copy)
@@ -180,7 +180,7 @@
def tearDown(self):
database.rollback_all()
- for item in self._get_soClasses():
+ for item in reversed(self._get_soClasses()):
if isinstance(item, types.TypeType) and issubclass(item,
sqlobject.SQLObject) and item != sqlobject.SQLObject \
and item != InheritableSQLObject: