diff --git a/tests/regressiontests/fixtures_regress/tests.py b/tests/regressiontests/fixtures_regress/tests.py index 575983ba81..b8e691490a 100644 --- a/tests/regressiontests/fixtures_regress/tests.py +++ b/tests/regressiontests/fixtures_regress/tests.py @@ -277,19 +277,21 @@ class TestFixtures(TestCase): 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 ()", "Weight = 1.2 ()") - ] - ) - 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 ()", "Weight = 1.2 ()") + ] + ) + finally: + signals.pre_save.disconnect(animal_pre_save_check) def test_dumpdata_uses_default_manager(self): """