Skip to content

Commit

Permalink
Fixed #16925 -- Make sure a signal is disconnected if the test fails.…
Browse files Browse the repository at this point in the history
… Thanks to aaugustin for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
alex committed Sep 26, 2011
1 parent 735fbcf commit 11c1e61
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions tests/regressiontests/fixtures_regress/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,21 @@ def test_field_value_coerce(self):
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):
"""
Expand Down

0 comments on commit 11c1e61

Please sign in to comment.