Author: Alex
Date: 2011-09-26 03:11:18 -0700 (Mon, 26 Sep 2011)
New Revision: 16905

Modified:
   django/trunk/tests/regressiontests/fixtures_regress/tests.py
Log:
Fixed #16925 -- Make sure a signal is disconnected if the test fails. Thanks to 
aaugustin for the patch.

Modified: django/trunk/tests/regressiontests/fixtures_regress/tests.py
===================================================================
--- django/trunk/tests/regressiontests/fixtures_regress/tests.py        
2011-09-26 01:37:57 UTC (rev 16904)
+++ django/trunk/tests/regressiontests/fixtures_regress/tests.py        
2011-09-26 10:11:18 UTC (rev 16905)
@@ -277,19 +277,21 @@
         global pre_save_checks
         pre_save_checks = []
         signals.pre_save.connect(animal_pre_save_check)
-        management.call_command(
-            'loaddata',
-            'animal.xml',
-            verbosity=0,
-            commit=False,
-        )
-        self.assertEqual(
-            pre_save_checks,
-            [
-                ("Count = 42 (<type 'int'>)", "Weight = 1.2 (<type 'float'>)")
-            ]
-        )
-        signals.pre_save.disconnect(animal_pre_save_check)
+        try:
+            management.call_command(
+                'loaddata',
+                'animal.xml',
+                verbosity=0,
+                commit=False,
+            )
+            self.assertEqual(
+                pre_save_checks,
+                [
+                    ("Count = 42 (<type 'int'>)", "Weight = 1.2 (<type 
'float'>)")
+                ]
+            )
+        finally:
+            signals.pre_save.disconnect(animal_pre_save_check)
 
     def test_dumpdata_uses_default_manager(self):
         """

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to