Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1674 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

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

Reported by: mw44118 Owned by: 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 Download (535 bytes) - added by mw44118 9 years ago.
diff showing my fix

Change History

Changed 9 years ago by mw44118

diff showing my fix

comment:1 Changed 9 years ago 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

comment:2 Changed 9 years ago by faide

  • Owner changed from anonymous to faide
  • Status changed from new to assigned

comment:3 Changed 9 years ago by faide

Applied in r3898. Thanks!

comment:4 Changed 9 years ago by faide

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:5 Changed 9 years ago by faide

r3899 will work _way_ better :)

Note: See TracTickets for help on using tickets.