Fixed #16925 -- Make sure a signal is disconnected if the test fails. Thanks to aaugustin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
735fbcfe8b
commit
11c1e61b99
|
@ -277,19 +277,21 @@ class TestFixtures(TestCase):
|
||||||
global pre_save_checks
|
global pre_save_checks
|
||||||
pre_save_checks = []
|
pre_save_checks = []
|
||||||
signals.pre_save.connect(animal_pre_save_check)
|
signals.pre_save.connect(animal_pre_save_check)
|
||||||
management.call_command(
|
try:
|
||||||
'loaddata',
|
management.call_command(
|
||||||
'animal.xml',
|
'loaddata',
|
||||||
verbosity=0,
|
'animal.xml',
|
||||||
commit=False,
|
verbosity=0,
|
||||||
)
|
commit=False,
|
||||||
self.assertEqual(
|
)
|
||||||
pre_save_checks,
|
self.assertEqual(
|
||||||
[
|
pre_save_checks,
|
||||||
("Count = 42 (<type 'int'>)", "Weight = 1.2 (<type 'float'>)")
|
[
|
||||||
]
|
("Count = 42 (<type 'int'>)", "Weight = 1.2 (<type 'float'>)")
|
||||||
)
|
]
|
||||||
signals.pre_save.disconnect(animal_pre_save_check)
|
)
|
||||||
|
finally:
|
||||||
|
signals.pre_save.disconnect(animal_pre_save_check)
|
||||||
|
|
||||||
def test_dumpdata_uses_default_manager(self):
|
def test_dumpdata_uses_default_manager(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue