Ticket #1674 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

[PATCH] In teardown function in testutil.py, we should destroy dependent tables first

Reported by: mw44118 Assigned to: faide
Priority: normal Milestone: 1.0.4
Component: TurboGears Version: 1.0.4b3
Severity: normal Keywords: testutil soClasses
Cc:

Description

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:

Attachments

matt.diff (0.5 kB) - added by mw44118 on 01/11/08 15:31:27.
diff showing my fix

Change History

01/11/08 15:31:27 changed by mw44118

  • attachment matt.diff added.

diff showing my fix

01/11/08 15:35:41 changed by mw44118

  • summary changed from In teardown function in testutil.py, we shoud destroy dependent tables first to [PATCH] In teardown function in testutil.py, we should destroy dependent tables first.

01/12/08 15:16:36 changed by faide

  • owner changed from anonymous to faide.
  • status changed from new to assigned.

01/12/08 16:29:28 changed by faide

Applied in r3898. Thanks!

01/12/08 16:30:01 changed by faide

  • status changed from assigned to closed.
  • resolution set to fixed.

01/12/08 17:10:15 changed by faide

r3899 will work _way_ better :)